fccedc8604cbf1f13b3ec789c9898f30133b2a94
[platform/core/uifw/dali-toolkit.git] / capi / dali-toolkit / public-api / controls / cluster / cluster-style.h
1 #ifndef __DALI_TOOLKIT_CLUSTER_STYLE_H__
2 #define __DALI_TOOLKIT_CLUSTER_STYLE_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //     http://floralicense.org/license/
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19
20 /**
21  * @addtogroup CAPI_DALI_FRAMEWORK
22  * @{
23  */
24
25 // INTERNAL INCLUDES
26 #include <dali/dali.h>
27 #include <dali-toolkit/public-api/enums.h>
28
29 namespace Dali DALI_IMPORT_API
30 {
31
32 struct TimePeriod;
33 class Actor;
34
35 namespace Toolkit
36 {
37
38 namespace Internal DALI_INTERNAL
39 {
40 class ClusterStyle;
41 class ClusterStyleRandom;
42 }
43
44 class ClusterStyle;
45
46 typedef IntrusivePtr<ClusterStyle> ClusterStylePtr;
47
48 /**
49  * A ClusterStyle describes the constraints, which are imposed on the child actors in the cluster.
50  */
51 class ClusterStyle : public Dali::BaseHandle
52 {
53 public:
54
55   static const unsigned int UNLIMITED_CHILDREN;
56
57 public:
58
59   /**
60    * Virtual destructor.
61    */
62   virtual ~ClusterStyle();
63
64   /**
65    * Query the maximum number of children this Style can handle.
66    * If return value is UNLIMITED_CHILDREN, then this style has no
67    * limit.
68    * @return The maximum number of children.
69    */
70   unsigned int GetMaximumNumberOfChildren() const;
71
72   /**
73    * Applies style (position) to child actor over a specified time duration.
74    *
75    * @param[in] child The child actor to apply
76    * @param[in] index The style position index for the actor to transform to.
77    * @param[in] alpha The alpha function to use.
78    * @param[in] durationSeconds The time period to apply this style.
79    */
80   void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds);
81
82   /**
83    * Applies style to background actor over a specified time duration.
84    * @param[in] background The background actor to apply
85    * @param[in] alpha The alpha function to use.
86    * @param[in] durationSeconds The time period to apply this style.
87    */
88   void ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds);
89
90   /**
91    * Applies style to title actor over a specified time duration.
92    * @param[in] title The title actor to apply
93    * @param[in] alpha The alpha function to use.
94    * @param[in] durationSeconds The time period to apply this style.
95    */
96   void ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds);
97
98 protected:
99
100   /**
101    * Create a new ClusterStyle; Only derived versions are instantiatable.
102    */
103   ClusterStyle();
104
105 public: // Not intended for application developers
106
107   /**
108    * This constructor is used by Dali New() methods
109    * @param [in] internal A pointer to a newly allocated Dali resource
110    */
111   ClusterStyle(Internal::ClusterStyle* internal);
112 };
113
114 /**
115  * A ClusterStyle describes the constraints, which are imposed on the child actors in the cluster.
116  */
117 class ClusterStyleStandard : public ClusterStyle
118 {
119 public:
120
121   enum StyleType
122   {
123     ClusterStyle1,
124     ClusterStyle2,
125     ClusterStyle3,
126     ClusterStyle4,
127     TotalClusterStyles
128   };
129
130 public:
131
132   /**
133    * Create an initialized style
134    */
135   static ClusterStyleStandard New(StyleType style);
136
137 public: // Not intended for application developers
138
139   /**
140    * This constructor is used by Dali New() methods
141    * @param [in] internal A pointer to a newly allocated Dali resource
142    */
143   ClusterStyleStandard(Internal::ClusterStyle* internal);
144 };
145
146 /**
147  * A ClusterStyle describes the constraints, which are imposed on the child actors in the cluster.
148  */
149 class ClusterStyleRandom : public ClusterStyle
150 {
151 public:
152
153   /**
154    * Create an initialized style
155    */
156   static ClusterStyleRandom New();
157
158 public: // Not intended for application developers
159
160   /**
161    * This constructor is used by Dali New() methods
162    * @param [in] internal A pointer to a newly allocated Dali resource
163    */
164   ClusterStyleRandom(Internal::ClusterStyle* internal);
165 };
166
167 } // namespace Toolkit
168
169 } // namespace Dali
170
171 /**
172  * @}
173  */
174 #endif // __DALI_TOOLKIT_CLUSTER_STYLE_H__