summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2019-05-29 15:35:19 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-05-30 11:48:19 +0200
commit8113f3f5658f655de1605f188b56db697453d101 (patch)
tree2fe28058afb86631d181d8a0b6997acd1d20043d
parent37266b93a5ec5c9345190f91418480c7108407fb (diff)
Efl.Ui.Active_View: Update Docs
This should clarify how the different components of this new widget are meant to be used. Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9044
-rw-r--r--src/lib/elementary/efl_ui_active_view_container.eo69
-rw-r--r--src/lib/elementary/efl_ui_active_view_indicator.eo44
-rw-r--r--src/lib/elementary/efl_ui_active_view_view_manager.eo58
3 files changed, 105 insertions, 66 deletions
diff --git a/src/lib/elementary/efl_ui_active_view_container.eo b/src/lib/elementary/efl_ui_active_view_container.eo
index db51332cf0..052e35808c 100644
--- a/src/lib/elementary/efl_ui_active_view_container.eo
+++ b/src/lib/elementary/efl_ui_active_view_container.eo
@@ -1,61 +1,88 @@
1struct @beta Efl.Ui.Active_View.Transition_Event { 1struct @beta Efl.Ui.Active_View.Transition_Event {
2 from : int; [[The id from where the transition started, -1 if not known]] 2 [[Information regarding transition events.]]
3 to : int; [[The id from where the transition started, -1 if not known]] 3 from : int; [[The view index from where the transition started, -1 if not known.]]
4 to : int; [[The view index to where the transition is headed, -1 if not known.]]
4} 5}
5 6
6enum Efl.Ui.Active_View.Container_Gravity { 7enum Efl.Ui.Active_View.Container_Gravity {
7 content = 0, [[In case the internal list of content is changed, then the $active_index will always point to the same content]] 8 [[This enum controls the behavior of @Efl.Ui.Active_View.Container.active_index when indices are
8 index = 1, [[In case the internal list of content is changed, then the $active_index will keep its value]] 9 shifted due to object addition or removal.]]
10 content = 0, [[When a view is added or removed from the container, the @Efl.Ui.Active_View.Container.active_index will
11 be adjusted as necessary so it points to the same view as before.]]
12 index = 1, [[When a view is added or removed from the container, the @Efl.Ui.Active_View.Container.active_index will
13 remain the same, possibly pointing to a different view.]]
9} 14}
10 15
11class @beta Efl.Ui.Active_View.Container extends Efl.Ui.Layout_Base implements Efl.Pack_Linear 16class @beta Efl.Ui.Active_View.Container extends Efl.Ui.Layout_Base implements Efl.Pack_Linear
12{ 17{
13 [[ The active view widget can be used to display the added content in some animated way. The details of the animation and way of displaying depends on the transition object. 18 [[The Active View widget is a container for other sub-widgets (views), where only one sub-widget is active at any given time.
14 The size of the displayed content can be controlled via $active_view_size. The content with the main attraction can be setted with $active_index.
15 19
16 Without a transition object this widget will just display the content with the id set with $active_index. On page changes, 20 Views are added using the @Efl.Pack_Linear interface and the active view is selected using @.active_index.
21
22 The way the different views are rendered can be customized through the @.view_manager object. For example, only the active view
23 might be shown, or it might be shown in a central position whereas the other views are displayed on the sides, or grayed-out.
24 All views are displayed with the same size, selected with @.active_view_size.
25
26 Additionally, the transition from one view to another can be animated. This animation is also controlled by the @.view_manager object.
27
28 Also, an indicator widget can be used to show a visual cue of how many views are there and which one is the active one.
29
30 This class can be used to create other widgets like Pagers, Tabbed pagers or Stacks, where each view represents a "page" full
31 of other widgets. All these cases can be implemented with a different @.view_manager and use the same @Efl.Ui.Active_View.Container.
17 ]] 32 ]]
18 c_prefix: efl_ui_active_view; 33 c_prefix: efl_ui_active_view;
19 methods { 34 methods {
20 @property view_manager { 35 @property view_manager {
21 [[The transition object which defines the animation and exact position of the content]] 36 [[This object defines how views are rendered and animated.
37 If it is not set, only the active view is shown and transitions are instantaneous (not animated).
38 ]]
22 values { 39 values {
23 transition : Efl.Ui.Active_View.View_Manager @owned; 40 view_manager : Efl.Ui.Active_View.View_Manager @owned; [[The View Manager object or $NULL.]]
24 } 41 }
25 } 42 }
26 @property indicator { 43 @property indicator {
27 [[A indicator object which can be used to display the state and position of the content in this widget 44 [[An indicator object to use, which will display the current state of the Active View (number of views and active one).
28 When this object here is set, the position of the indicator object is immidiatly called to the current position of the widget 45 When this object is set, it is immediately updated to reflect the current state of the widget.
46 Its location inside the container is controlled by the @.view_manager.
29 ]] 47 ]]
30 values { 48 values {
31 indicator : Efl.Ui.Active_View.Indicator @owned; 49 indicator : Efl.Ui.Active_View.Indicator @owned; [[The Indicator object or $NULL.]]
32 } 50 }
33 } 51 }
34 @property active_index { 52 @property active_index {
35 [[Selects which is the maincontent to display by this widget. The exact positioning depends on the $transition object]] 53 [[Currently active view among all the views added to this widget.
54
55 Changing this value might trigger an animation.
56 ]]
36 values { 57 values {
37 index: int; 58 index: int; [[Index of the active view, from 0 to the number of views - 1 (@Efl.Container.content_count - 1).]]
38 } 59 }
39 } 60 }
40 @property active_view_gravity { 61 @property active_view_gravity {
41 [[active_view can be used to set the currently active viewed content. 62 [[When a new view is added to this widget, the indices for the previous views might change (for example,
63 when adding a view at the beginning of the list with @Efl.Pack_Linear.pack_begin all previous view's indices are increased by one).
64
65 This property controls whether the Active View should remain the same view as before (@Efl.Ui.Active_View.Container_Gravity.content)
66 or if the Active View should be moved to the one with the same index as before (@Efl.Ui.Active_View.Container_Gravity.index).
42 67
43 This property can be used to switch_to the semantic of the function. If gravity is content, then newly added content will change the index, but keep the content. If the gravity is set to index, then the index will stay when new content is added, which might show new content. 68 For example, @Efl.Ui.Active_View.Container_Gravity.index can be used to build a Stack, where @.active_index is always 0 and new
69 views are pushed onto the stack with @Efl.Pack_Linear.pack_begin and popped from the stack with @Efl.Pack_Linear.pack_unpack_at 0.
44 ]] 70 ]]
45 values { 71 values {
46 gravity : Efl.Ui.Active_View.Container_Gravity; 72 gravity : Efl.Ui.Active_View.Container_Gravity; [[Active View behavior when adding new views. Default is @Efl.Ui.Active_View.Container_Gravity.content.]]
47 } 73 }
48 } 74 }
49 @property active_view_size { 75 @property active_view_size {
50 [[The size that is give to each content when displayed]] 76 [[The size to use when displaying the Active View. This is used by the @.view_manager to perform the rendering.
77 Views other than the Active one may or may not use this size.]]
51 values { 78 values {
52 size: Eina.Size2D; 79 size: Eina.Size2D; [[Render size for the Active View. (-1, -1) means that all available space inside the container is used.]]
53 } 80 }
54 } 81 }
55 } 82 }
56 events { 83 events {
57 transition,start : Efl.Ui.Active_View.Transition_Event; 84 transition,start : Efl.Ui.Active_View.Transition_Event; [[A transition animation has started.]]
58 transition,end : Efl.Ui.Active_View.Transition_Event; 85 transition,end : Efl.Ui.Active_View.Transition_Event; [[A transition animation has ended.]]
59 } 86 }
60 implements { 87 implements {
61 Efl.Object.constructor; 88 Efl.Object.constructor;
diff --git a/src/lib/elementary/efl_ui_active_view_indicator.eo b/src/lib/elementary/efl_ui_active_view_indicator.eo
index 053b56ab3f..687595106b 100644
--- a/src/lib/elementary/efl_ui_active_view_indicator.eo
+++ b/src/lib/elementary/efl_ui_active_view_indicator.eo
@@ -1,48 +1,54 @@
1abstract @beta Efl.Ui.Active_View.Indicator extends Efl.Object { 1abstract @beta Efl.Ui.Active_View.Indicator extends Efl.Object {
2 [[Indicator object that is used by @Efl.Ui.Active_View.Container]] 2 [[Object used by @Efl.Ui.Active_View.Container to render an indication of the active view's position among
3 the rest of the container's views.
4
5 An example would be Android's little dots in the home screen.
6 ]]
3 methods { 7 methods {
4 bind @pure_virtual { 8 bind @pure_virtual {
5 [[Initial call to flush the required objects of the active view to the transition object 9 [[This method is called the first time an @Efl.Ui.Active_View.Indicator is assigned to an @Efl.Ui.Active_View.Container, binding them together.
6 10
7 This call can be used to setup the indicator part of $active_view. 11 This call can be used to setup the indicator part of the $active_view.
8 12
9 if there is a position of the widget, then after this call, $position_update will be called. 13 The Active View of the container (if there is any) will be informed to the indicator by a later call to @.position_update.
10 ]] 14 ]]
11 params { 15 params {
12 active_view : Efl.Ui.Active_View.Container; 16 active_view : Efl.Ui.Active_View.Container; [[The container to bind this indicator to.]]
13 } 17 }
14 } 18 }
15 content_add @pure_virtual { 19 content_add @pure_virtual {
16 [[Content has been added to the container passed in .bind. The $subobj is at position $index. 20 [[A $subobj has been added at position $index in the bound container.
17 21
18 While in the call, the $current_page property of the active_view might change. 22 The manager should check the container's @Efl.Ui.Active_View.Container.active_index since indices might have
19 If such a change is happening. No animation should be displayed, and the new state should be applied. 23 shifted due to the insertion of the new object.
20 ]] 24 ]]
21 params { 25 params {
22 subobj : Efl.Gfx.Entity; 26 subobj : Efl.Gfx.Entity; [[The new object that has been added to the container.]]
23 index : int; 27 index : int; [[The index of the new object in the container's list.]]
24 } 28 }
25 } 29 }
26 content_del @pure_virtual { 30 content_del @pure_virtual {
27 [[Content has been removed from the container passed in .bind. The $subobj at position $index is now removed. 31 [[The $subobj at position $index in the bound container has been removed.
28 32
29 While in the call, the $current_page property of the active_view might change. 33 The manager should check the container's @Efl.Ui.Active_View.Container.active_index since indices might have
30 If such a change is happening. No animation should be displayed, and the new state should be applied. 34 shifted due to the removal of the object.
31 ]] 35 ]]
32 params { 36 params {
33 subobj : Efl.Gfx.Entity; 37 subobj : Efl.Gfx.Entity; [[The object being removed from the container.]]
34 index : int; 38 index : int; [[The index this object had in the container's list.]]
35 } 39 }
36 } 40 }
37 position_update @pure_virtual { 41 position_update @pure_virtual {
38 [[The position between the content has been changed. 42 [[This method tells the indicator that @Efl.Ui.Active_View.Container.active_index has changed in the bound container.
39 43
40 The position is absolut and ranges from [-1,x + 1] where x is the number of contents in the active_view. 44 $position ranges from -1 to the number of views in the bound container (@Efl.Container.content_count).
45 Notice this allows moving to a position before the first view or past the last view, which might happen if the view
46 is thumb-scrolled out-of-bounds. Indicators can choose to render these out-of-bounds positions or not.
41 47
42 Values between two actaul positions must be expected as this is the way the animation of the transition object populates to the indicator 48 Fractional values indicate positions in-between two views and should be respected to obtain a smooth transition.
43 ]] 49 ]]
44 params { 50 params {
45 position : double; [[The position the transition object is currently in]] 51 position : double; [[The index of the active view, or a value in-between views if a transition is currently playing.]]
46 } 52 }
47 } 53 }
48 } 54 }
diff --git a/src/lib/elementary/efl_ui_active_view_view_manager.eo b/src/lib/elementary/efl_ui_active_view_view_manager.eo
index a97fc4078f..a6f039aaff 100644
--- a/src/lib/elementary/efl_ui_active_view_view_manager.eo
+++ b/src/lib/elementary/efl_ui_active_view_view_manager.eo
@@ -1,65 +1,71 @@
1abstract @beta Efl.Ui.Active_View.View_Manager extends Efl.Object { 1abstract @beta Efl.Ui.Active_View.View_Manager extends Efl.Object {
2 [[Transition object which is used by active_view. 2 [[Manager object used by @Efl.Ui.Active_View.Container to handle rendering and animation of its views, and user interaction.
3 3
4 The transition object can display changes to the active view with animations. 4 For instance, changes to the currently active view (@Efl.Ui.Active_View.Container.active_index) can be animated with a transition.
5 This object can also implement behavior user interaction in a animation manner. For example: Mouse dragging content, to get to a new $current_page. If this is the case, such a user interaction should terminate with a call to $current_page. The position of the content should be exposed by emitting pos_update. 5 This object can also handle user interaction. For example, dragging the active view to one side to get to a different view (like an Android home screen).
6 Such user interactions should end up setting a new @Efl.Ui.Active_View.Container.active_index.
7 During a transition, the evolution of the current position should be exposed by emitting $pos_update events.
6 ]] 8 ]]
7 methods { 9 methods {
8 bind @pure_virtual { 10 bind @pure_virtual {
9 [[Initial call to flush the required objects of the active view to the transition object]] 11 [[This method is called the first time an @Efl.Ui.Active_View.View_Manager is assigned to an @Efl.Ui.Active_View.Container, binding them together.
12 The manager can read the current content of the container, subscribe to events, or do any initialization it requires.
13 ]]
10 params { 14 params {
11 active_view : Efl.Ui.Active_View.Container; 15 active_view : Efl.Ui.Active_View.Container; [[The container to bind the view manager to.]]
12 group : Efl.Canvas.Group; 16 group : Efl.Canvas.Group; [[The graphical group where the views should be added with @Efl.Canvas.Group.group_member_add and removed with @Efl.Canvas.Group.group_member_remove.]]
13 } 17 }
14 } 18 }
15 content_add @pure_virtual { 19 content_add @pure_virtual {
16 [[Content has been added to the container passed in .bind. The $subobj is at position $index. 20 [[A $subobj has been added at position $index in the bound container.
17 21
18 While in the call, the $current_page property of the active_view might change. 22 The manager should check the container's @Efl.Ui.Active_View.Container.active_index since indices might have
19 If such a change is happening. No animation should be displayed, and the new state should be applied. 23 shifted due to the insertion of the new object.
20 ]] 24 ]]
21 params { 25 params {
22 subobj : Efl.Gfx.Entity; 26 subobj : Efl.Gfx.Entity; [[The new object that has been added to the container.]]
23 index : int; 27 index : int; [[The index of the new object in the container's list.]]
24 } 28 }
25 } 29 }
26 content_del @pure_virtual { 30 content_del @pure_virtual {
27 [[Content has been removed from the container passed in .bind. The $subobj at position $index is now removed. 31 [[The $subobj at position $index in the bound container has been removed.
28 32
29 While in the call, the $current_page property of the active_view might change. 33 The manager should check the container's @Efl.Ui.Active_View.Container.active_index since indices might have
30 If such a change is happening. No animation should be displayed, and the new state should be applied. 34 shifted due to the removal of the object.
31 ]] 35 ]]
32 params { 36 params {
33 subobj : Efl.Gfx.Entity; 37 subobj : Efl.Gfx.Entity; [[The object being removed from the container.]]
34 index : int; 38 index : int; [[The index this object had in the container's list.]]
35 } 39 }
36 } 40 }
37 switch_to @pure_virtual { 41 switch_to @pure_virtual {
38 [[Switch from one side to another, if there has been no side before, from is -1. 42 [[Switch from one view to another. If there was no previous view, $from might be -1.
39 This function should, if the transition object supports this, display a animation. 43 This function should display an animation if the @Efl.Ui.Active_View.View_Manager supports them.
40 ]] 44 ]]
41 params { 45 params {
42 from : int; 46 from : int; [[Index of the starting view in the container's list. Might be -1 if unknown.]]
43 to : int; 47 to : int; [[Index of the target view in the container's list.]]
44 } 48 }
45 } 49 }
46 @property view_size @pure_virtual { 50 @property view_size @pure_virtual {
47 [[Will be called whenever the page size changes]] 51 [[Will be called whenever the @Efl.Ui.Active_View.Container.active_view_size changes so the @Efl.Ui.Active_View.View_Manager can update itself.]]
48 set { 52 set {
49
50 } 53 }
51 values { 54 values {
52 size : Eina.Size2D; [[The size of the page, real coordiates at any time]] 55 size : Eina.Size2D; [[The new size of the views.]]
53 } 56 }
54 } 57 }
55 @property animation_enabled @pure_virtual { 58 @property animation_enabled @pure_virtual {
56 [[This flag can be used to indicate that no animations should be done]] 59 [[This flag can be used to disable animations.]]
57 values { 60 values {
58 enable : bool; [[$true if you want animations to happen, $false if otherwise]] 61 enable : bool; [[$true if you want animations to happen, $false otherwise.]]
59 } 62 }
60 } 63 }
61 } 64 }
62 events { 65 events {
63 pos_update : double; [[The absolut position where the state of the content currently is. So if there is a animation from 2 to 3 the event will go from 2.0 to 3.0. If there is a $switch_to from 2 to 3, then this event should go in one direction from 2 to 3. Not following this, will result in a event to abort the transition, and instanciating a new one.]] 66 pos_update : double; [[Index of the view currently being displayed. Fractional values indicate a position in-between views.
67 For instance, when transitioning from view 2 to view 3, this event should be emitted with monotonically
68 increasing values ranging from 2.0 to 3.0.
69 Animations can perform any movement they want, but the reported $pos_update must move in the same direction.]]
64 } 70 }
65} 71}