2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/public-api/object/ref-object.h>
20 #include <dali/public-api/common/dali-common.h>
21 #include <dali/public-api/math/vector3.h>
22 #include <dali/public-api/object/base-object.h>
23 #include <dali-toolkit/public-api/controls/cluster/cluster-style.h>
38 typedef IntrusivePtr<ClusterStyle> ClusterStylePtr;
41 * ClusterStyle internal implementation
43 class ClusterStyle : public Dali::BaseObject
48 * @copydoc Toolkit::ClusterStyle::GetMaximumNumberOfChildren
50 unsigned int GetMaximumNumberOfChildren() const;
53 * @copydoc Toolkit::ClusterStyle::ApplyStyle
55 virtual void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds) = 0;
58 * @copydoc Toolkit::ClusterStyle::ApplyStyleToBackground
60 virtual void ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds) = 0;
63 * @copydoc Toolkit::ClusterStyle::ApplyStyleToTitle
65 virtual void ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds) = 0;
70 * Set the maximum number of children this Style can handle.
71 * @param[in] The maximum number of children.
73 void SetMaximumNumberOfChildren(unsigned int children);
76 * Set the title properties
77 * @param[in] relativePosition Relative position of the title
78 * @param[in] offsetPosition Offset position of the title
79 * @param[in] size The size of the title
81 void SetTitleProperties(const Vector3& relativePosition,
82 const Vector3& offsetPosition,
86 * Set the background properties
87 * @param[in] relativePosition Relative position of the background
88 * @param[in] offsetPosition Offset position of the background
89 * @param[in] size The size of the title
91 void SetBackgroundProperties(const Vector3& relativePosition,
92 const Vector3& offsetPosition,
98 * Protected constructor see ClusterStyle::New().
103 * A reference counted object may only be deleted by calling Unreference()
105 virtual ~ClusterStyle();
109 unsigned int mMaxChildren; ///< Maximum number of children that this style supports
110 Vector3 mTitlePositionRelative; ///< Title's position relative to size of cluster
111 Vector3 mTitlePositionOffset; ///< Title's position offset
112 Vector3 mTitleSize; ///< Title's size relative to size of cluster
113 Vector3 mBackgroundPositionRelative; ///< Background's position relative to size of cluster
114 Vector3 mBackgroundPositionOffset; ///< Background's position offset
115 Vector3 mBackgroundSize; ///< Background's size relative to size of cluster
120 * ClusterStyleStandard internal implementation
122 class ClusterStyleStandard : public ClusterStyle
126 typedef Toolkit::ClusterStyleStandard::StyleType StyleType;
131 * Create a new cluster style.
132 * @param[in] style The style type to create.
133 * @return A smart-pointer to the newly allocated ClusterStyle.
135 static ClusterStylePtr New(StyleType style);
140 * @copydoc Toolkit::ClusterStyle::ApplyStyle
142 void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds);
145 * @copydoc Toolkit::ClusterStyle::ApplyStyleToBackground
147 void ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds);
150 * @copydoc Toolkit::ClusterStyle::ApplyStyleToTitle
152 void ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds);
157 * Set the relative sizes of the children
158 * @param[in] size The list of sizes for the children
160 void SetSizes(const float *sizes);
163 * Set the relative positions of the children
164 * @param[in] positions The list of positions for the children
166 void SetPositions(const Vector3 *positions);
171 * Protected constructor see ClusterStyleRandom::New().
173 ClusterStyleStandard(StyleType style);
177 const float *mSizes; ///< List of sizes
178 const Vector3 *mPositions; ///< List of positions
183 * ClusterStyleRandom internal implementation
185 class ClusterStyleRandom : public ClusterStyle
190 * Create a new cluster style.
191 * @return A smart-pointer to the newly allocated ClusterStyle.
193 static ClusterStylePtr New();
198 * @copydoc Toolkit::ClusterStyle::ApplyStyle
200 void ApplyStyle(Actor child, unsigned int index, AlphaFunction alpha, const TimePeriod& durationSeconds);
203 * @copydoc Toolkit::ClusterStyle::ApplyStyleToBackground
205 void ApplyStyleToBackground(Actor background, AlphaFunction alpha, const TimePeriod& durationSeconds);
208 * @copydoc Toolkit::ClusterStyle::ApplyStyleToTitle
210 void ApplyStyleToTitle(Actor title, AlphaFunction alpha, const TimePeriod& durationSeconds);
215 * Protected constructor see ClusterStyleRandom::New().
217 ClusterStyleRandom();
223 } // namespace Internal
225 // Helpers for public-api forwarding methods
227 inline Internal::ClusterStyle& GetImpl(Toolkit::ClusterStyle& pub)
229 DALI_ASSERT_ALWAYS(pub);
231 Dali::RefObject& handle = pub.GetBaseObject();
233 return static_cast<Internal::ClusterStyle&>(handle);
236 inline const Internal::ClusterStyle& GetImpl(const Toolkit::ClusterStyle& pub)
238 DALI_ASSERT_ALWAYS(pub);
240 const Dali::RefObject& handle = pub.GetBaseObject();
242 return static_cast<const Internal::ClusterStyle&>(handle);
245 } // namespace Toolkit