7454797bf54cd6eb81206a2d645d980a546755d5
[platform/core/uifw/dali-toolkit.git] / optional / 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 Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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 // INTERNAL INCLUDES
22 #include <dali/dali.h>
23 #include <dali-toolkit/public-api/enums.h>
24
25 namespace Dali DALI_IMPORT_API
26 {
27
28 struct TimePeriod;
29 class Actor;
30
31 namespace Toolkit
32 {
33
34 namespace Internal DALI_INTERNAL
35 {
36 class ClusterStyle;
37 class ClusterStyleRandom;
38 }
39
40 class ClusterStyle;
41
42 typedef IntrusivePtr<ClusterStyle> ClusterStylePtr; ///< Pointer to a Dali::Toolkit::ClusterStyle object
43
44 /**
45  * @brief A ClusterStyle describes the constraints which are imposed on the child actors in the cluster.
46  */
47 class ClusterStyle : public Dali::BaseHandle
48 {
49 public:
50
51   static const unsigned int UNLIMITED_CHILDREN; ///< Constant that represents an unlimited number of children.
52
53 public:
54
55   /**
56    * @brief Destructor
57    *
58    * This is non-virtual since derived Handle types must not contain data or virtual methods.
59    */
60   ~ClusterStyle();
61
62   /**
63    * @brief Query the maximum number of children this Style can handle.
64    *
65    * If return value is UNLIMITED_CHILDREN, then this style has no
66    * limit.
67    * @return The maximum number of children.
68    */
69   unsigned int GetMaximumNumberOfChildren() const;
70
71   /**
72    * @brief Applies style (position) to child actor over a specified time duration.
73    *
74    * @param[in] child The child actor to apply
75    * @param[in] index The style position index for the actor to transform to.
76    * @param[in] alpha The alpha function to use.
77    * @param[in] durationSeconds The time period to apply this style.
78    */
79   void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds);
80
81   /**
82    * @brief Applies style to background actor over a specified time duration.
83    *
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    * @brief Applies style to title actor over a specified time duration.
92    *
93    * @param[in] title The title actor to apply
94    * @param[in] alpha The alpha function to use.
95    * @param[in] durationSeconds The time period to apply this style.
96    */
97   void ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds);
98
99 protected:
100
101   /**
102    * @brief Create a new ClusterStyle; Only derived versions are instantiatable.
103    */
104   ClusterStyle();
105
106 public: // Not intended for application developers
107
108   /**
109    * @brief This constructor is used by Dali New() methods.
110    *
111    * @param [in] internal A pointer to a newly allocated Dali resource
112    */
113   ClusterStyle(Internal::ClusterStyle* internal);
114 };
115
116 /**
117  * @brief A ClusterStyle describes the constraints, which are imposed on the child actors in the cluster.
118  */
119 class ClusterStyleStandard : public ClusterStyle
120 {
121 public:
122
123   /**
124    * @brief Cluster Style type.
125    */
126   enum StyleType
127   {
128     ClusterStyle1,     ///< Style number 1
129     ClusterStyle2,     ///< Style number 2
130     ClusterStyle3,     ///< Style number 3
131     ClusterStyle4,     ///< Style number 4
132     TotalClusterStyles ///< The number of styles
133   };
134
135 public:
136
137   /**
138    * @brief Create an initialized style.
139    */
140   static ClusterStyleStandard New(StyleType style);
141
142 public: // Not intended for application developers
143
144   /**
145    * @brief This constructor is used by Dali New() methods.
146    *
147    * @param [in] internal A pointer to a newly allocated Dali resource
148    */
149   ClusterStyleStandard(Internal::ClusterStyle* internal);
150 };
151
152 /**
153  * @brief A ClusterStyle describes the constraints, which are imposed on the child actors in the cluster.
154  */
155 class ClusterStyleRandom : public ClusterStyle
156 {
157 public:
158
159   /**
160    * @brief Create an initialized style.
161    */
162   static ClusterStyleRandom New();
163
164 public: // Not intended for application developers
165
166   /**
167    * @brief This constructor is used by Dali New() methods.
168    *
169    * @param [in] internal A pointer to a newly allocated Dali resource
170    */
171   ClusterStyleRandom(Internal::ClusterStyle* internal);
172 };
173
174 } // namespace Toolkit
175
176 } // namespace Dali
177
178 #endif // __DALI_TOOLKIT_CLUSTER_STYLE_H__