efl/src/lib/elementary/efl_ui_widget_scroll_manager.h

132 lines
2.9 KiB
C
Raw Normal View History

scroller: Introducing Efl.Ui.Scroller Summary: scrollable widgets had a interface_scrollable as a mixin so that the widgets had a 'is-a' relation with interface_scrollabe. however, new scroller concept don't have 'is-a' relationship, but 'has-a' relationship. scrollable widgets should have a scroll manager inside them, then scroll manager handles event from user and api implementations. and also we cut the features such as paging because there will be aka 'elm_pager'. we are expecting that the new concept make us to maintain the scroller easier. please excuse for many unorganized code and logics. : ( [contained commit] scrollable: add efl_ui_scroller example scrollable: refactoring for behavior in case of multiple scroller scrollable: remove repetitive scrollbar code. scrollable: combine calculating bounce distance code. scroll_manager: mouse up function refactoring scroll_manager: mouse move function refactoring scroll_manager: warp animator wip scroll_manager: fix denominator value when calculating flicking behavior. Fix to disconnect bounce animator once animation is done gather duplicated animator drop logics gather duplicated conditions Rearrange prototypes and append comment Add manipulate functions for animators scroll_manager: change member_add function. scroll_manger: apply mirroring logic scroll_manager: apply scrollbar apply API to scroller widget scroll_manager: apply scroll event callback Change logics for all about scroll animating efl_ui_pan: add efl_ui_pan scrollable: change content_min_limit to match_content scroll theme: apply overlapped scrollbar + many others! Reviewers: akanad, woohyun, cedric, jpeg Subscribers: jenkins, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5222 Note by @jpeg: Unfortunately this patch comes in a massive single blob, after too many rebase operations. It has now come to a point where I think the API is nice and it works as I'd expect. Now I only wonder how applicable this will be for Efl.Ui.List. As we can see Photocam (legacy and unified API) could be transformed to use this new API.
2017-12-18 04:08:25 -08:00
#ifndef EFL_UI_WIDGET_SCROLL_MANAGER_H
#define EFL_UI_WIDGET_SCROLL_MANAGER_H
#include "Elementary.h"
typedef double (*Interpolator)(void *data, double progress);
typedef enum {
INTERP_LINEAR,
INTERP_ACCEL,
INTERP_DECEL,
scroller: Introducing Efl.Ui.Scroller Summary: scrollable widgets had a interface_scrollable as a mixin so that the widgets had a 'is-a' relation with interface_scrollabe. however, new scroller concept don't have 'is-a' relationship, but 'has-a' relationship. scrollable widgets should have a scroll manager inside them, then scroll manager handles event from user and api implementations. and also we cut the features such as paging because there will be aka 'elm_pager'. we are expecting that the new concept make us to maintain the scroller easier. please excuse for many unorganized code and logics. : ( [contained commit] scrollable: add efl_ui_scroller example scrollable: refactoring for behavior in case of multiple scroller scrollable: remove repetitive scrollbar code. scrollable: combine calculating bounce distance code. scroll_manager: mouse up function refactoring scroll_manager: mouse move function refactoring scroll_manager: warp animator wip scroll_manager: fix denominator value when calculating flicking behavior. Fix to disconnect bounce animator once animation is done gather duplicated animator drop logics gather duplicated conditions Rearrange prototypes and append comment Add manipulate functions for animators scroll_manager: change member_add function. scroll_manger: apply mirroring logic scroll_manager: apply scrollbar apply API to scroller widget scroll_manager: apply scroll event callback Change logics for all about scroll animating efl_ui_pan: add efl_ui_pan scrollable: change content_min_limit to match_content scroll theme: apply overlapped scrollbar + many others! Reviewers: akanad, woohyun, cedric, jpeg Subscribers: jenkins, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5222 Note by @jpeg: Unfortunately this patch comes in a massive single blob, after too many rebase operations. It has now come to a point where I think the API is nice and it works as I'd expect. Now I only wonder how applicable this will be for Efl.Ui.List. As we can see Photocam (legacy and unified API) could be transformed to use this new API.
2017-12-18 04:08:25 -08:00
} InterpType;
typedef struct _Efl_Ui_Scroll_Manager_Data
{
Evas_Coord x, y, w, h;
Evas_Coord wx, wy, ww, wh; /**< Last "wanted" geometry */
Evas_Object *obj;
Evas_Object *pan_obj;
Evas_Object *event_rect;
Evas_Object *parent;
Efl_Ui_Scrollbar_Mode hbar_mode, vbar_mode;
Ecore_Timer *hbar_timer, *vbar_timer;
2019-09-03 00:17:43 -07:00
Efl_Ui_Layout_Orientation block;
scroller: Introducing Efl.Ui.Scroller Summary: scrollable widgets had a interface_scrollable as a mixin so that the widgets had a 'is-a' relation with interface_scrollabe. however, new scroller concept don't have 'is-a' relationship, but 'has-a' relationship. scrollable widgets should have a scroll manager inside them, then scroll manager handles event from user and api implementations. and also we cut the features such as paging because there will be aka 'elm_pager'. we are expecting that the new concept make us to maintain the scroller easier. please excuse for many unorganized code and logics. : ( [contained commit] scrollable: add efl_ui_scroller example scrollable: refactoring for behavior in case of multiple scroller scrollable: remove repetitive scrollbar code. scrollable: combine calculating bounce distance code. scroll_manager: mouse up function refactoring scroll_manager: mouse move function refactoring scroll_manager: warp animator wip scroll_manager: fix denominator value when calculating flicking behavior. Fix to disconnect bounce animator once animation is done gather duplicated animator drop logics gather duplicated conditions Rearrange prototypes and append comment Add manipulate functions for animators scroll_manager: change member_add function. scroll_manger: apply mirroring logic scroll_manager: apply scrollbar apply API to scroller widget scroll_manager: apply scroll event callback Change logics for all about scroll animating efl_ui_pan: add efl_ui_pan scrollable: change content_min_limit to match_content scroll theme: apply overlapped scrollbar + many others! Reviewers: akanad, woohyun, cedric, jpeg Subscribers: jenkins, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5222 Note by @jpeg: Unfortunately this patch comes in a massive single blob, after too many rebase operations. It has now come to a point where I think the API is nice and it works as I'd expect. Now I only wonder how applicable this will be for Efl.Ui.List. As we can see Photocam (legacy and unified API) could be transformed to use this new API.
2017-12-18 04:08:25 -08:00
struct
{
Evas_Coord x, y;
Evas_Coord sx, sy;
struct
{
Evas_Coord x, y;
double timestamp;
scroller: Introducing Efl.Ui.Scroller Summary: scrollable widgets had a interface_scrollable as a mixin so that the widgets had a 'is-a' relation with interface_scrollabe. however, new scroller concept don't have 'is-a' relationship, but 'has-a' relationship. scrollable widgets should have a scroll manager inside them, then scroll manager handles event from user and api implementations. and also we cut the features such as paging because there will be aka 'elm_pager'. we are expecting that the new concept make us to maintain the scroller easier. please excuse for many unorganized code and logics. : ( [contained commit] scrollable: add efl_ui_scroller example scrollable: refactoring for behavior in case of multiple scroller scrollable: remove repetitive scrollbar code. scrollable: combine calculating bounce distance code. scroll_manager: mouse up function refactoring scroll_manager: mouse move function refactoring scroll_manager: warp animator wip scroll_manager: fix denominator value when calculating flicking behavior. Fix to disconnect bounce animator once animation is done gather duplicated animator drop logics gather duplicated conditions Rearrange prototypes and append comment Add manipulate functions for animators scroll_manager: change member_add function. scroll_manger: apply mirroring logic scroll_manager: apply scrollbar apply API to scroller widget scroll_manager: apply scroll event callback Change logics for all about scroll animating efl_ui_pan: add efl_ui_pan scrollable: change content_min_limit to match_content scroll theme: apply overlapped scrollbar + many others! Reviewers: akanad, woohyun, cedric, jpeg Subscribers: jenkins, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5222 Note by @jpeg: Unfortunately this patch comes in a massive single blob, after too many rebase operations. It has now come to a point where I think the API is nice and it works as I'd expect. Now I only wonder how applicable this will be for Efl.Ui.List. As we can see Photocam (legacy and unified API) could be transformed to use this new API.
2017-12-18 04:08:25 -08:00
} history[60];
double est_timestamp_diff;
scroller: Introducing Efl.Ui.Scroller Summary: scrollable widgets had a interface_scrollable as a mixin so that the widgets had a 'is-a' relation with interface_scrollabe. however, new scroller concept don't have 'is-a' relationship, but 'has-a' relationship. scrollable widgets should have a scroll manager inside them, then scroll manager handles event from user and api implementations. and also we cut the features such as paging because there will be aka 'elm_pager'. we are expecting that the new concept make us to maintain the scroller easier. please excuse for many unorganized code and logics. : ( [contained commit] scrollable: add efl_ui_scroller example scrollable: refactoring for behavior in case of multiple scroller scrollable: remove repetitive scrollbar code. scrollable: combine calculating bounce distance code. scroll_manager: mouse up function refactoring scroll_manager: mouse move function refactoring scroll_manager: warp animator wip scroll_manager: fix denominator value when calculating flicking behavior. Fix to disconnect bounce animator once animation is done gather duplicated animator drop logics gather duplicated conditions Rearrange prototypes and append comment Add manipulate functions for animators scroll_manager: change member_add function. scroll_manger: apply mirroring logic scroll_manager: apply scrollbar apply API to scroller widget scroll_manager: apply scroll event callback Change logics for all about scroll animating efl_ui_pan: add efl_ui_pan scrollable: change content_min_limit to match_content scroll theme: apply overlapped scrollbar + many others! Reviewers: akanad, woohyun, cedric, jpeg Subscribers: jenkins, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5222 Note by @jpeg: Unfortunately this patch comes in a massive single blob, after too many rebase operations. It has now come to a point where I think the API is nice and it works as I'd expect. Now I only wonder how applicable this will be for Efl.Ui.List. As we can see Photocam (legacy and unified API) could be transformed to use this new API.
2017-12-18 04:08:25 -08:00
double onhold_vx, onhold_vy;
double onhold_vxe, onhold_vye;
double onhold_tlast;
double last_time_x_wheel;
double last_time_y_wheel;
int hdir, vdir;
Evas_Coord hold_x, hold_y;
Ecore_Idle_Enterer *hold_enterer;
double dragged_began_timestamp;
Eina_Bool dragged : 1;
Eina_Bool dragged_began : 1;
Eina_Bool hold_animator : 1;
Eina_Bool onhold_animator : 1;
Eina_Bool last_hold_x_wheel : 1;
Eina_Bool last_hold_y_wheel : 1;
Eina_Bool dir_x : 1;
Eina_Bool dir_y : 1;
Eina_Bool scroll : 1;
Eina_Bool hold : 1;
Eina_Bool now : 1;
Eina_Bool want_reset : 1;
} down;
struct
{
Evas_Coord w, h;
Eina_Bool resized : 1;
} content_info;
struct
{
Evas_Coord x, y;
} step, page;
struct
{
struct
{
Evas_Coord start, end;
Eina_Bool animator;
Interpolator interp;
double start_t, dur;
} x, y;
} scrollto;
struct
{
struct
{
Evas_Coord p0, p1, p2;
double vel;
Eina_Bool animator;
double start_t;
double t01, t12;
} x, y;
} bounce;
double last_wheel_mul;
unsigned int last_wheel;
void *event_info;
double gravity_x, gravity_y;
Evas_Coord prev_cw, prev_ch;
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 bouncemey : 1;
Eina_Bool bouncemex : 1;
Eina_Bool freeze : 1;
Eina_Bool freeze_want : 1;
Eina_Bool hold : 1;
Eina_Bool match_content_w : 1;
Eina_Bool match_content_h : 1;
Eina_Bool loop_h : 1;
Eina_Bool loop_v : 1;
Eina_Bool scrolling : 1;
} Efl_Ui_Scroll_Manager_Data;
#endif