summaryrefslogtreecommitdiff
path: root/src/lib/efl/interfaces
diff options
context:
space:
mode:
authorWonki Kim <wonki_.kim@samsung.com>2017-12-18 21:08:25 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-19 10:26:25 +0900
commit47bf356435d7b4562e64f45ef59dbf190dff16c7 (patch)
tree32dec1cca747dc2e062ff8a7bd9586500a8289dc /src/lib/efl/interfaces
parent29ce7550eb3fa2f1c5f4c82d30e5e625b2c60058 (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.
Diffstat (limited to 'src/lib/efl/interfaces')
-rw-r--r--src/lib/efl/interfaces/efl_interfaces_main.c4
-rw-r--r--src/lib/efl/interfaces/efl_ui_scrollable.eo26
-rw-r--r--src/lib/efl/interfaces/efl_ui_scrollable_interactive.eo156
-rw-r--r--src/lib/efl/interfaces/efl_ui_scrollbar.eo70
4 files changed, 255 insertions, 1 deletions
diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c
index 3f19f054f8..ec7366c1ee 100644
--- a/src/lib/efl/interfaces/efl_interfaces_main.c
+++ b/src/lib/efl/interfaces/efl_interfaces_main.c
@@ -3,6 +3,8 @@
3#endif 3#endif
4 4
5#define EFL_CANVAS_BETA 5#define EFL_CANVAS_BETA
6#define EFL_UI_SCROLLBAR_PROTECTED
7#define EFL_UI_SCROLLBAR_BETA
6 8
7#include <Efl.h> 9#include <Efl.h>
8 10
@@ -75,6 +77,8 @@
75#include "interfaces/efl_ui_draggable.eo.c" 77#include "interfaces/efl_ui_draggable.eo.c"
76#include "interfaces/efl_ui_clickable.eo.c" 78#include "interfaces/efl_ui_clickable.eo.c"
77#include "interfaces/efl_ui_scrollable.eo.c" 79#include "interfaces/efl_ui_scrollable.eo.c"
80#include "interfaces/efl_ui_scrollable_interactive.eo.c"
81#include "interfaces/efl_ui_scrollbar.eo.c"
78#include "interfaces/efl_ui_selectable.eo.c" 82#include "interfaces/efl_ui_selectable.eo.c"
79#include "interfaces/efl_ui_zoom.eo.c" 83#include "interfaces/efl_ui_zoom.eo.c"
80 84
diff --git a/src/lib/efl/interfaces/efl_ui_scrollable.eo b/src/lib/efl/interfaces/efl_ui_scrollable.eo
index 366e2c02f9..203120613d 100644
--- a/src/lib/efl/interfaces/efl_ui_scrollable.eo
+++ b/src/lib/efl/interfaces/efl_ui_scrollable.eo
@@ -1,9 +1,33 @@
1enum Efl.Ui.Scroll_Block
2{
3 [[Direction in which a scroller should be blocked.
4
5 Note: These options may be effective only in case of thumbscroll (i.e.
6 when scrolling by dragging).
7
8 @since 1.21
9 ]]
10 none = 0, [[Don't block any movement.]]
11 vertical = 1, [[Block vertical movement.]]
12 horizontal = 2 [[Block horizontal movement.]]
13}
14
1interface Efl.Ui.Scrollable () 15interface Efl.Ui.Scrollable ()
2{ 16{
3 [[Efl UI scrollable interface]] 17 [[Efl UI scrollable interface]]
4 event_prefix: efl_ui; 18 event_prefix: efl_ui;
5 events { 19 events {
6 scroll; [[Called when scroll operation started]] 20 scroll,start; [[Called when scroll operation started]]
21 scroll; [[Called when scroll operation]]
22 scroll,stop; [[Called when scroll operation stopped]]
23 scroll,up; [[Called when scrolling to upwards]]
24 scroll,down; [[Called when scrolling to downwards]]
25 scroll,left; [[Called when scrolling to left]]
26 scroll,right; [[Called when scrolling to right]]
27 edge,up; [[Called when hitting the top edge]]
28 edge,down; [[Called when hitting the bottom edge]]
29 edge,left; [[Called when hitting the left edge]]
30 edge,right; [[Called when hitting the right edge]]
7 scroll,anim,start; [[Called when scroll animation started]] 31 scroll,anim,start; [[Called when scroll animation started]]
8 scroll,anim,stop; [[Called when scroll animation stopped]] 32 scroll,anim,stop; [[Called when scroll animation stopped]]
9 scroll,drag,start; [[Called when scroll drag started]] 33 scroll,drag,start; [[Called when scroll drag started]]
diff --git a/src/lib/efl/interfaces/efl_ui_scrollable_interactive.eo b/src/lib/efl/interfaces/efl_ui_scrollable_interactive.eo
new file mode 100644
index 0000000000..f25192e374
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_ui_scrollable_interactive.eo
@@ -0,0 +1,156 @@
1import eina_types;
2
3interface Efl.Ui.Scrollable.Interactive (Efl.Ui.Scrollable)
4{
5 eo_prefix: efl_ui_scrollable;
6 methods {
7 @property content_pos {
8 [[The content position]]
9 set {
10 }
11 get {
12 }
13 values {
14 pos: Eina.Position2D; [[The position is virtual value, (0, 0) starting at the top-left.]]
15 }
16 }
17 @property content_size {
18 [[The content size]]
19 get {
20 }
21 values {
22 size: Eina.Size2D; [[The content size in pixels.]]
23 }
24 }
25 @property viewport_geometry {
26 [[The viewport geometry]]
27 get {
28 }
29 values {
30 rect: Eina.Rect; [[It is absolute geometry.]]
31 }
32 }
33 @property bounce_enabled {
34 [[Bouncing behavior
35
36 When scrolling, the scroller may "bounce" when reaching an edge of the
37 content object. This is a visual way to indicate the end has been reached.
38 This is enabled by default for both axis. This API will set if it is enabled
39 for the given axis with the boolean parameters for each axis.]]
40 set {
41 }
42 get {
43 }
44 values {
45 horiz: bool; [[Horizontal bounce policy.]]
46 vert: bool; [[Vertical bounce policy.]]
47 }
48 }
49 @property scroll_freeze {
50 [[Freeze property
51 This function will freeze scrolling movement (by input of a user).
52 Unlike efl_ui_scrollable_movement_block_set, this function freezes bidirectional.
53 If you want to freeze only one direction,
54 See @.movement_block.set.
55 ]]
56 get {
57 }
58 set {
59 }
60 values {
61 freeze: bool; [[$true if freeze, $false otherwise]]
62 }
63 }
64 @property scroll_hold {
65 [[Hold property
66 When hold turns on, it only scrolls by holding action.
67 ]]
68 get {
69 }
70 set {
71 }
72 values {
73 hold: bool; [[$true if hold, $false otherwise]]
74 }
75 }
76 @property looping {
77 [[Controls an infinite loop for a scroller.]]
78 set {
79 }
80 get {
81 }
82 values {
83 loop_h: bool; [[The scrolling horizontal loop]]
84 loop_v: bool; [[The Scrolling vertical loop]]
85 }
86 }
87 @property movement_block {
88 [[Blocking of scrolling (per axis)
89
90 This function will block scrolling movement (by input of a user) in
91 a given direction. One can disable movements in the X axis, the Y
92 axis or both. The default value is $none, where movements are
93 allowed in both directions.
94 ]]
95 set {
96 }
97 get {
98 }
99 values {
100 block: Efl.Ui.Scroll_Block(Efl.Ui.Scroll_Block.none); [[Which axis (or axes) to block]]
101 }
102 }
103 @property gravity {
104 [[Control scrolling gravity on the scrollable
105
106 The gravity defines how the scroller will adjust its view
107 when the size of the scroller contents increases.
108
109 The scroller will adjust the view to glue itself as follows.
110
111 x=0.0, for staying where it is relative to the left edge of the content
112 x=1.0, for staying where it is relative to the rigth edge of the content
113 y=0.0, for staying where it is relative to the top edge of the content
114 y=1.0, for staying where it is relative to the bottom edge of the content
115
116 Default values for x and y are 0.0]]
117 set {
118 }
119 get {
120 }
121 values {
122 x: double; [[Horizontal scrolling gravity]]
123 y: double; [[Vertical scrolling gravity]]
124 }
125 }
126 @property match_content {
127 [[Prevent the scrollable from being smaller than the minimum size of the content.
128
129 By default the scroller will be as small as its design allows,
130 irrespective of its content. This will make the scroller minimum size the
131 right size horizontally and/or vertically to perfectly fit its content in
132 that direction.]]
133 set {
134 }
135 values {
136 w: bool; [[Whether to limit the minimum horizontal size]]
137 h: bool; [[Whether to limit the minimum vertical size]]
138 }
139 }
140 scroll {
141 [[Show a specific virtual region within the scroller content object.
142
143 This will ensure all (or part if it does not fit) of the designated
144 region in the virtual content object (0, 0 starting at the top-left of the
145 virtual content object) is shown within the scroller. This allows the scroller to "smoothly slide"
146 to this location (if configuration in general calls for transitions). It
147 may not jump immediately to the new location and make take a while and
148 show other content along the way.
149 ]]
150 params {
151 @in rect: Eina.Rect; [[The position where to scroll. and The size user want to see]]
152 @in animation: bool; [[Whether to scroll with animation or not]]
153 }
154 }
155 }
156}
diff --git a/src/lib/efl/interfaces/efl_ui_scrollbar.eo b/src/lib/efl/interfaces/efl_ui_scrollbar.eo
new file mode 100644
index 0000000000..a539e82d24
--- /dev/null
+++ b/src/lib/efl/interfaces/efl_ui_scrollbar.eo
@@ -0,0 +1,70 @@
1enum Efl.Ui.Scrollbar_Mode
2{
3 auto = 0, [[Visible if necessary]]
4 on, [[Always visible]]
5 off, [[Always invisible]]
6 last [[]]
7}
8
9enum Efl.Ui.Scrollbar_Direction
10{
11 horizontal = 0,
12 vertical,
13 last
14}
15interface Efl.Ui.Scrollbar ()
16{
17 methods {
18 @property bar_mode {
19 [[Scrollbar visibility policy]]
20 set {
21 }
22 get {
23 }
24 values {
25 hbar: Efl.Ui.Scrollbar_Mode; [[Horizontal scrollbar]]
26 vbar: Efl.Ui.Scrollbar_Mode; [[Vertical scrollbar]]
27 }
28 }
29 @property bar_size {
30 [[Scrollbar size.
31 It is calculated based on viewport size-content sizes.
32 ]]
33 get {
34 }
35 values {
36 width: double; [[Value between 0.0 and 1.0]]
37 height: double; [[Value between 0.0 and 1.0]]
38 }
39 }
40 @property bar_position {
41 [[Scrollbar position.
42 It is calculated based on current position-maximum positions.
43 ]]
44 set {
45 }
46 get {
47 }
48 values {
49 posx: double; [[Value between 0.0 and 1.0]]
50 posy: double; [[Value between 0.0 and 1.0]]
51 }
52 }
53 bar_visibility_update @protected @beta{
54 [[ Update bar visibility.
55
56 The object will call this function whenever the bar
57 need to be shown or hidden.
58 ]]
59 }
60 }
61 events {
62 bar,press; [[Called when bar is pressed]]
63 bar,unpress; [[Called when bar is unpressed]]
64 bar,drag; [[Called when bar is dragged]]
65 bar,size,changed; [[Called when bar size is changed]]
66 bar,pos,changed; [[Called when bar position is changed]]
67 bar,show; [[Callend when bar is shown]]
68 bar,hide; [[Called when bar is hidden]]
69 }
70}