summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_active_view_container.eo
blob: b4c46fee0d150535ebb37cd57b0177c44d36b045 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
struct  @beta Efl.Ui.Active_View.Transition_Event {
   [[Information regarding transition events.]]
   from : int; [[The view index from where the transition started, -1 if not known.]]
   to : int; [[The view index to where the transition is headed, -1 if not known.]]
}

class @beta Efl.Ui.Active_View.Container extends Efl.Ui.Layout_Base implements Efl.Pack_Linear
{
   [[The Active View widget is a container for other sub-widgets (views), where only one sub-widget is active at any given time.

     Views are added using the @Efl.Pack_Linear interface and the active view is selected using @.active_index.

     The way the different views are rendered can be customized through the @.view_manager object. For example, only the active view
     might be shown, or it might be shown in a central position whereas the other views are displayed on the sides, or grayed-out.
     All views are displayed with the same size, selected with @.active_view_size.

     Additionally, the transition from one view to another can be animated. This animation is also controlled by the @.view_manager object.

     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.

     This class can be used to create other widgets like Pagers, Tabbed pagers or Stacks, where each view represents a "page" full
     of other widgets. All these cases can be implemented with a different @.view_manager and use the same @Efl.Ui.Active_View.Container.
   ]]
   c_prefix: efl_ui_active_view;
   methods {
      @property view_manager {
        [[This object defines how views are rendered and animated.
          If it is not set, only the active view is shown and transitions are instantaneous (not animated).
        ]]
        values {
          view_manager : Efl.Ui.Active_View.View_Manager @owned; [[The View Manager object or $NULL.]]
        }
      }
      @property indicator {
        [[An indicator object to use, which will display the current state of the Active View (number of views and active one).
          When this object is set, it is immediately updated to reflect the current state of the widget.
          Its location inside the container is controlled by the @.view_manager.
        ]]
        values {
          indicator : Efl.Ui.Active_View.Indicator @owned; [[The Indicator object or $NULL.]]
        }
      }
      @property active_index {
         [[Currently active view among all the views added to this widget.

           Changing this value might trigger an animation.
         ]]
         values {
            index: int; [[Index of the active view, from 0 to the number of views - 1 (@Efl.Container.content_count - 1).]]
         }
      }
      @property active_view_size {
         [[The size to use when displaying the Active View. This is used by the @.view_manager to perform the rendering.
           Views other than the Active one may or may not use this size.]]
         values {
            size: Eina.Size2D; [[Render size for the Active View. (-1, -1) means that all available space inside the container is used.]]
         }
      }
      push @beta {
         [[Packs a new view at the position indicated by @.active_index (0 by default).

           This is the same behavior as a push operation on a stack.

           An animation might be triggered to make the new active view come into position.
         ]]
         params {
            view : Efl.Gfx.Entity; [[View to add and set to be the active view.]]
         }
      }
      pop @beta {
         [[Removes the active view from the widget.

           The views behind it naturally flow down so the next one becomes the active view. This is the same behavior as a pop operation on a stack.
           When combined with @.push you don't have to worry about @.active_index since only the first view is manipulated.

           An animation might be triggered to make the new active view come into position and the old one disappear.

           The removed view can be returned to the caller or deleted (depending on $delete_on_transition_end).
         ]]
         params {
            deletion_on_transition_end : bool; [[ if $true, then the object will be deleted before resolving the future, and a NULL pointer is the value of the future. $false if no operation should be applied to it]]
         }
         return : future<Efl.Gfx.Entity>; [[ This Future gets resolved when any transition animation finishes and the popped view is ready for collection.
                                             If there is no animation, the Future resolves immediately.
                                             If $deletion_on_transition_end is $true then this widget will destroy the popped view and the Future will contain no Value. Otherwise, the caller becomes the owner of the view contained in the Future and must dispose of it appropriately. ]]
      }
   }
   events {
      transition,start : Efl.Ui.Active_View.Transition_Event; [[A transition animation has started.]]
      transition,end : Efl.Ui.Active_View.Transition_Event; [[A transition animation has ended.]]
   }
   implements {
      Efl.Object.constructor;
      Efl.Object.finalize;
      Efl.Object.invalidate;
      Efl.Container.content_count;
      Efl.Container.content_iterate;
      Efl.Pack.pack_clear;
      Efl.Pack.unpack_all;
      Efl.Pack.unpack;
      Efl.Pack.pack;
      Efl.Pack_Linear.pack_begin;
      Efl.Pack_Linear.pack_end;
      Efl.Pack_Linear.pack_before;
      Efl.Pack_Linear.pack_after;
      Efl.Pack_Linear.pack_at;
      Efl.Pack_Linear.pack_content_get;
      Efl.Pack_Linear.pack_index_get;
      Efl.Pack_Linear.pack_unpack_at;
   }
}