1 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_BASE_H__
2 #define __DALI_TOOLKIT_INTERNAL_SCROLL_BASE_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 // TODO - Replace list with dali-vector.h
24 #include <dali/public-api/animation/constraint.h>
28 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
29 #include <dali-toolkit/internal/controls/scrollable/scrollable-impl.h>
42 typedef IntrusivePtr<Actor> ActorPtr;
43 typedef std::list<Constraint> ConstraintStack;
46 * ScrollBase represents a set of properties (time, position
47 * scale etc.) that constrain a set of actors.
49 class ScrollBase : public Scrollable
53 struct ActorInfo : public Dali::RefObject
56 * ActorInfo constructor
57 * @param[in] actor The actor that this ActorInfo represents.
59 ActorInfo(Actor actor)
65 * ActorInfo destructor
66 * removes scrollview-related constraints only.
74 * Apply a constraint to this actor
75 * The constraint will be applied to the actor,
76 * and the ActorInfo will keep track of this constraint.
77 * @param[in] constraint The constraint to apply to the actor
79 void ApplyConstraint(Constraint constraint)
81 Constraint clone = constraint.Clone( mActor );
83 mConstraints.push_back( clone );
87 * Remove constraints from this actor.
88 * All of the constraints that have been applied to the
89 * actor via this ActorInfo will be removed.
91 void RemoveConstraints()
93 std::vector<Constraint>::iterator it = mConstraints.begin();
94 std::vector<Constraint>::iterator end = mConstraints.end();
102 Actor mActor; ///< The Actor that this ActorInfo represents.
103 std::vector<Constraint> mConstraints; ///< A list keeping track of constraints applied to the actor via this delegate.
106 typedef IntrusivePtr<ActorInfo> ActorInfoPtr;
107 typedef std::vector<ActorInfoPtr> ActorInfoContainer;
108 typedef ActorInfoContainer::iterator ActorInfoIter;
109 typedef ActorInfoContainer::const_iterator ActorInfoConstIter;
114 * Sets the delay in seconds.
115 * This delay affects the animation timing for all
118 * @param[in] delay The delay in seconds.
120 void SetDelay(float delay)
126 * Gets the current delay in seconds.
128 * @return The delay in seconds.
130 float GetDelay() const
138 * Sets ScrollBase Parent
140 * @param[in] parent The parent that this ScrollBase belongs to.
142 void SetParent(ScrollBase *parent);
145 * Bind Actor to this scroll view/group.
146 * Once Bound, this scroll view/group will affect the actor (child)
148 * @param[in] child The actor to be bound.
150 void BindActor(Actor child);
153 * Unbind Actor from this scroll view/group
154 * Once Unbound, this scroll view/group will not affect the actor
156 * @note this does not remove the child from the ScrollView container
158 * @param[in] child The actor to be unbound
160 void UnbindActor(Actor child);
163 * Searches associated ScrollBases for the Actor, and attempts to Unbind
164 * systematically this Actor from the ScrollView or Groups attached.
166 * @param[in] child The actor to be unbound.
168 virtual void FindAndUnbindActor(Actor child);
171 * Applies constraint to the bound actors within this ScrollView/Group only.
173 * @param[in] constraint, the constraint to apply to these bound actors and future
176 void ApplyConstraintToBoundActors(Constraint constraint);
179 * Removes all constraints from the bound actors within this ScrollView/Group only.
181 void RemoveConstraintsFromBoundActors();
185 static const char* const SCROLL_DOMAIN_OFFSET_PROPERTY_NAME;
190 * Construct a new ScrollBase.
195 * @brief Construct a new ScrollBase.
197 * @param[in] behaviourFlags Flags to enable
199 ScrollBase( ControlBehaviour behaviourFlags );
203 ScrollBase *mParent; ///< Pointer to ScrollBase parent, if exists.
207 float mDelay; ///< delay in seconds.
208 ConstraintStack mConstraintStack; ///< The list of constraints to apply to any actors
209 ActorInfoContainer mBoundActors; ///< The list of actors that have been bound to this ScrollBase.
213 } // namespace Internal
215 } // namespace Toolkit
219 #endif // __DALI_TOOLKIT_INTERNAL_SCROLL_GROUP_H__