2012-07-04 14:41:01 -07:00
|
|
|
#ifndef ELM_INTEFARCE_SCROLLER_H
|
|
|
|
#define ELM_INTEFARCE_SCROLLER_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup Widget
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @section elm-scrollable-interface The Elementary Scrollable Interface
|
|
|
|
*
|
|
|
|
* This is a common interface for widgets having @b scrollable views.
|
|
|
|
* Widgets using/implementing this must use the
|
|
|
|
* @c EVAS_SMART_SUBCLASS_IFACE_NEW macro (instead of the
|
|
|
|
* @c EVAS_SMART_SUBCLASS_NEW one) when declaring its smart class,
|
|
|
|
* so an interface is also declared.
|
|
|
|
*
|
|
|
|
* The scrollable interface comes built with Elementary and is exposed
|
|
|
|
* as #ELM_SCROLLABLE_IFACE.
|
|
|
|
*
|
|
|
|
* The interface API is explained in details at
|
|
|
|
* #Elm_Scrollable_Smart_Interface.
|
|
|
|
*
|
|
|
|
* An Elementary scrollable interface will handle an internal @b
|
|
|
|
* panning object. It has the function of clipping and moving the
|
|
|
|
* actual scrollable content around, by the command of the scrollable
|
|
|
|
* interface calls. Though it's not the common case, one might
|
|
|
|
* want/have to change some aspects of the internal panning object
|
|
|
|
* behavior. For that, we have it also exposed here --
|
|
|
|
* #Elm_Pan_Smart_Class. Use elm_pan_smart_class_get() to build your
|
|
|
|
* custom panning object, when creating a scrollable widget (again,
|
|
|
|
* only if you need a custom panning object) and set it with
|
|
|
|
* Elm_Scrollable_Smart_Interface::extern_pan_set.
|
|
|
|
*/
|
|
|
|
|
2019-09-16 11:59:56 -07:00
|
|
|
#include <elm_pan_eo.legacy.h>
|
|
|
|
#include <elm_scroller.h>
|
2014-03-17 06:52:41 -07:00
|
|
|
|
2012-07-04 14:41:01 -07:00
|
|
|
/**
|
|
|
|
* Elementary scroller panning base smart data.
|
|
|
|
*/
|
|
|
|
typedef struct _Elm_Pan_Smart_Data Elm_Pan_Smart_Data;
|
|
|
|
struct _Elm_Pan_Smart_Data
|
|
|
|
{
|
|
|
|
Evas_Object *self;
|
|
|
|
Evas_Object *content;
|
2018-11-22 06:47:52 -08:00
|
|
|
Evas_Object *interface_object;
|
2012-07-04 14:41:01 -07:00
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
Evas_Coord content_w, content_h, px, py;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Elementary scrollable interface base data.
|
|
|
|
*/
|
2012-11-25 22:32:53 -08:00
|
|
|
typedef void (*Elm_Interface_Scrollable_Cb)(Evas_Object *, void *data);
|
|
|
|
typedef void (*Elm_Interface_Scrollable_Min_Limit_Cb)(Evas_Object *obj, Eina_Bool w, Eina_Bool h);
|
2013-06-29 23:15:08 -07:00
|
|
|
typedef void (*Elm_Interface_Scrollable_Resize_Cb)(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2012-07-04 14:41:01 -07:00
|
|
|
typedef struct _Elm_Scrollable_Smart_Interface_Data
|
|
|
|
Elm_Scrollable_Smart_Interface_Data;
|
2016-04-19 08:00:21 -07:00
|
|
|
|
|
|
|
#include "elm_interface_scrollable.eo.h"
|
|
|
|
|
2012-07-04 14:41:01 -07:00
|
|
|
struct _Elm_Scrollable_Smart_Interface_Data
|
|
|
|
{
|
2013-04-10 04:06:41 -07:00
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
Evas_Coord wx, wy, ww, wh; /**< Last "wanted" geometry */
|
2012-07-04 14:41:01 -07:00
|
|
|
|
2013-04-10 04:06:41 -07:00
|
|
|
Evas_Object *obj;
|
|
|
|
Evas_Object *content;
|
|
|
|
Evas_Object *pan_obj;
|
|
|
|
Evas_Object *edje_obj;
|
|
|
|
Evas_Object *event_rect;
|
2012-07-04 14:41:01 -07:00
|
|
|
|
2013-04-10 04:06:41 -07:00
|
|
|
Evas_Object *parent_widget;
|
2012-07-04 14:41:01 -07:00
|
|
|
|
2013-04-10 04:06:41 -07:00
|
|
|
Elm_Scroller_Policy hbar_flags, vbar_flags;
|
|
|
|
Elm_Scroller_Single_Direction one_direction_at_a_time;
|
2019-09-16 11:59:56 -07:00
|
|
|
Elm_Scroller_Movement_Block block;
|
2012-07-04 14:41:01 -07:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Evas_Coord x, y;
|
|
|
|
Evas_Coord sx, sy;
|
|
|
|
Evas_Coord dx, dy;
|
|
|
|
Evas_Coord pdx, pdy;
|
|
|
|
Evas_Coord bx, by;
|
|
|
|
Evas_Coord ax, ay;
|
|
|
|
Evas_Coord bx0, by0;
|
|
|
|
Evas_Coord b0x, b0y;
|
|
|
|
Evas_Coord b2x, b2y;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Evas_Coord x, y;
|
2018-08-19 21:56:46 -07:00
|
|
|
double timestamp;
|
2012-07-04 14:41:01 -07:00
|
|
|
} history[60];
|
|
|
|
|
2018-08-29 05:38:20 -07:00
|
|
|
double est_timestamp_diff;
|
2012-07-04 14:41:01 -07:00
|
|
|
|
2013-04-30 00:46:59 -07:00
|
|
|
double dragged_began_timestamp;
|
2012-07-04 14:41:01 -07:00
|
|
|
double anim_start;
|
|
|
|
double anim_start2;
|
|
|
|
double anim_start3;
|
2018-08-28 23:58:10 -07:00
|
|
|
double anim_dur;
|
|
|
|
|
2012-07-04 14:41:01 -07:00
|
|
|
double onhold_vx, onhold_vy, onhold_tlast,
|
|
|
|
onhold_vxe, onhold_vye;
|
2018-08-28 23:58:10 -07:00
|
|
|
|
2015-07-07 03:35:48 -07:00
|
|
|
double last_time_x_wheel;
|
|
|
|
double last_time_y_wheel;
|
2012-07-04 14:41:01 -07:00
|
|
|
|
|
|
|
Evas_Coord hold_x, hold_y;
|
|
|
|
Evas_Coord locked_x, locked_y;
|
|
|
|
int hdir, vdir;
|
|
|
|
|
2013-10-24 20:36:28 -07:00
|
|
|
Ecore_Idle_Enterer *hold_enterer;
|
2016-01-26 15:51:49 -08:00
|
|
|
|
|
|
|
Eina_Bool hold_animator : 1;
|
|
|
|
Eina_Bool onhold_animator : 1;
|
|
|
|
Eina_Bool momentum_animator : 1; /**< an animator which is called whenever a scroller is moving due to a flick action(mouse down, move, up) */
|
|
|
|
Eina_Bool bounce_x_animator : 1; /**< an animator to express the bouncing animation on x axis. */
|
|
|
|
Eina_Bool bounce_y_animator : 1; /**< an animator to express the bouncing animation on y axis. */
|
2012-07-04 14:41:01 -07:00
|
|
|
|
2015-07-07 03:35:48 -07:00
|
|
|
Eina_Bool last_hold_x_wheel : 1;
|
|
|
|
Eina_Bool last_hold_y_wheel : 1;
|
2012-07-04 14:41:01 -07:00
|
|
|
Eina_Bool bounce_x_hold : 1;
|
|
|
|
Eina_Bool bounce_y_hold : 1;
|
|
|
|
Eina_Bool dragged_began : 1;
|
|
|
|
Eina_Bool want_dragged : 1;
|
|
|
|
Eina_Bool hold_parent : 1;
|
|
|
|
Eina_Bool want_reset : 1;
|
|
|
|
Eina_Bool cancelled : 1;
|
|
|
|
Eina_Bool dragged : 1;
|
|
|
|
Eina_Bool locked : 1;
|
|
|
|
Eina_Bool scroll : 1;
|
|
|
|
Eina_Bool dir_x : 1;
|
|
|
|
Eina_Bool dir_y : 1;
|
|
|
|
Eina_Bool hold : 1;
|
|
|
|
Eina_Bool now : 1;
|
|
|
|
} down;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Evas_Coord w, h;
|
|
|
|
Eina_Bool resized : 1;
|
|
|
|
} content_info;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Evas_Coord x, y;
|
2013-05-15 14:56:04 -07:00
|
|
|
} step, page, current_page;
|
2012-07-04 14:41:01 -07:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Elm_Interface_Scrollable_Cb drag_start;
|
|
|
|
Elm_Interface_Scrollable_Cb drag_stop;
|
|
|
|
Elm_Interface_Scrollable_Cb animate_start;
|
|
|
|
Elm_Interface_Scrollable_Cb animate_stop;
|
|
|
|
Elm_Interface_Scrollable_Cb scroll;
|
2013-03-15 02:53:17 -07:00
|
|
|
Elm_Interface_Scrollable_Cb scroll_left;
|
|
|
|
Elm_Interface_Scrollable_Cb scroll_right;
|
|
|
|
Elm_Interface_Scrollable_Cb scroll_up;
|
|
|
|
Elm_Interface_Scrollable_Cb scroll_down;
|
2012-11-25 22:32:53 -08:00
|
|
|
Elm_Interface_Scrollable_Cb edge_left;
|
|
|
|
Elm_Interface_Scrollable_Cb edge_right;
|
|
|
|
Elm_Interface_Scrollable_Cb edge_top;
|
|
|
|
Elm_Interface_Scrollable_Cb edge_bottom;
|
Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress".
SVN revision: 83703
2013-02-06 22:13:31 -08:00
|
|
|
Elm_Interface_Scrollable_Cb vbar_drag;
|
|
|
|
Elm_Interface_Scrollable_Cb vbar_press;
|
|
|
|
Elm_Interface_Scrollable_Cb vbar_unpress;
|
|
|
|
Elm_Interface_Scrollable_Cb hbar_drag;
|
|
|
|
Elm_Interface_Scrollable_Cb hbar_press;
|
|
|
|
Elm_Interface_Scrollable_Cb hbar_unpress;
|
2013-05-15 14:56:04 -07:00
|
|
|
Elm_Interface_Scrollable_Cb page_change;
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
Elm_Interface_Scrollable_Min_Limit_Cb content_min_limit;
|
2013-06-29 22:42:34 -07:00
|
|
|
Elm_Interface_Scrollable_Resize_Cb content_viewport_resize;
|
2012-07-04 14:41:01 -07:00
|
|
|
} cb_func;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Evas_Coord start, end;
|
|
|
|
double t_start, t_end;
|
2016-01-26 15:51:49 -08:00
|
|
|
Eina_Bool animator;
|
2012-07-04 14:41:01 -07:00
|
|
|
} x, y;
|
|
|
|
} scrollto;
|
|
|
|
|
|
|
|
double pagerel_h, pagerel_v;
|
|
|
|
Evas_Coord pagesize_h, pagesize_v;
|
2013-04-05 21:06:43 -07:00
|
|
|
int page_limit_h, page_limit_v;
|
2014-02-14 00:29:11 -08:00
|
|
|
int current_calc;
|
2012-07-04 14:41:01 -07:00
|
|
|
|
2016-08-02 01:30:34 -07:00
|
|
|
double last_wheel_mul;
|
2015-02-12 20:14:07 -08:00
|
|
|
unsigned int last_wheel;
|
|
|
|
|
2013-11-26 02:32:35 -08:00
|
|
|
unsigned char size_adjust_recurse;
|
2014-02-14 00:29:11 -08:00
|
|
|
unsigned char size_count;
|
2015-08-07 01:27:30 -07:00
|
|
|
void *event_info;
|
2016-09-21 04:44:53 -07:00
|
|
|
|
|
|
|
double gravity_x, gravity_y;
|
|
|
|
Evas_Coord prev_cw, prev_ch;
|
|
|
|
|
2013-11-26 02:32:35 -08:00
|
|
|
Eina_Bool size_adjust_recurse_abort : 1;
|
|
|
|
|
2012-07-04 14:41:01 -07:00
|
|
|
Eina_Bool momentum_animator_disabled : 1;
|
|
|
|
Eina_Bool bounce_animator_disabled : 1;
|
2013-05-17 07:30:42 -07:00
|
|
|
Eina_Bool page_snap_horiz : 1;
|
|
|
|
Eina_Bool page_snap_vert : 1;
|
2012-07-04 14:41:01 -07:00
|
|
|
Eina_Bool wheel_disabled : 1;
|
|
|
|
Eina_Bool hbar_visible : 1;
|
|
|
|
Eina_Bool vbar_visible : 1;
|
|
|
|
Eina_Bool bounce_horiz : 1;
|
|
|
|
Eina_Bool bounce_vert : 1;
|
|
|
|
Eina_Bool is_mirrored : 1;
|
|
|
|
Eina_Bool extern_pan : 1;
|
|
|
|
Eina_Bool bouncemey : 1;
|
|
|
|
Eina_Bool bouncemex : 1;
|
|
|
|
Eina_Bool freeze : 1;
|
scroller: Fix freeze after dragging bars
The freeze property is a set() only but could internally
be reset to false, after dragging a vertical or horizontal slider.
Test scenario:
elementary_test -to scroller
Click Freeze, test the mouse wheel (can't do anything), drag a
scroller side bar, test the mouse wheel again.
Before this patch, the scroller would scroll. After the patch, the
scroller remains fixed, respecting the value of freeze.
FIXME: It is possible that the proper fix would be to disable
bars drag during freeze, but that is not the case currently.
NOTE: freeze, hold, movement_block, lock_x/y have very similar
meanings. The doc really needs clarification here, and some
property might be removed. Also, freeze and hold have no
getter, only a setter. drag_lock_x/y is part of elm_widget,
and not specific to scrollers.
2017-04-11 23:02:42 -07:00
|
|
|
Eina_Bool freeze_want : 1;
|
2012-07-04 14:41:01 -07:00
|
|
|
Eina_Bool hold : 1;
|
2012-07-17 23:59:16 -07:00
|
|
|
Eina_Bool min_w : 1;
|
|
|
|
Eina_Bool min_h : 1;
|
2012-08-07 03:20:30 -07:00
|
|
|
Eina_Bool go_left : 1;
|
|
|
|
Eina_Bool go_right : 1;
|
|
|
|
Eina_Bool go_up : 1;
|
|
|
|
Eina_Bool go_down : 1;
|
2015-01-23 19:01:03 -08:00
|
|
|
Eina_Bool loop_h : 1;
|
|
|
|
Eina_Bool loop_v : 1;
|
2016-12-20 08:25:57 -08:00
|
|
|
|
2019-09-16 11:59:56 -07:00
|
|
|
void *manager; /* Efl_Ui_Focus_Manager */
|
2012-07-04 14:41:01 -07:00
|
|
|
};
|
|
|
|
|
2012-07-31 15:05:50 -07:00
|
|
|
#define ELM_SCROLLABLE_CHECK(obj, ...) \
|
|
|
|
\
|
2016-08-15 06:44:41 -07:00
|
|
|
if (!efl_isa(obj, ELM_INTERFACE_SCROLLABLE_MIXIN)) \
|
2012-07-31 15:05:50 -07:00
|
|
|
{ \
|
2012-11-25 22:32:53 -08:00
|
|
|
ERR("The object (%p) doesn't implement the Elementary scrollable" \
|
|
|
|
" interface", obj); \
|
2012-07-31 15:05:50 -07:00
|
|
|
if (getenv("ELM_ERROR_ABORT")) abort(); \
|
|
|
|
return __VA_ARGS__; \
|
|
|
|
}
|
|
|
|
|
efl: remove EFL_EO_API_SUPPORT macro
Summary:
Since we're now going to be shipping some eo classes as stable,
there is no point in keeping the eo api behind a macro, and it
should be enabled by default. Another case is beta classes, but
those are behind the EFL_BETA_API_SUPPORT guard.
This also changes includes around the place where things are
clearly broken (such as an included header needing something
from another header but that other header being guarded, notably
efl_ui_widget.h needing focus manager but focus manager being
behind beta in Elementary.h)
Reviewers: zmike, cedric, bu5hm4n, stefan_schmidt, segfaultxavi
Reviewed By: cedric, segfaultxavi
Subscribers: segfaultxavi, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D8322
2019-03-18 04:13:41 -07:00
|
|
|
#ifdef EFL_BETA_API_SUPPORT
|
2017-02-22 22:32:17 -08:00
|
|
|
EAPI void elm_pan_gravity_set(Elm_Pan *, double x, double) EINA_DEPRECATED;
|
|
|
|
EAPI void elm_pan_gravity_get(const Elm_Pan *, double *, double *) EINA_DEPRECATED;
|
|
|
|
#endif
|
|
|
|
|
2012-07-04 14:41:01 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endif
|