Merge remote-tracking branch 'origin/tizen' into new_text
[platform/core/uifw/dali-core.git] / dali / internal / event / animation / animator-connector-base.h
1 #ifndef __DALI_INTERNAL_ANIMATOR_CONNECTOR_BASE_H__
2 #define __DALI_INTERNAL_ANIMATOR_CONNECTOR_BASE_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 // EXTERNAL INCLUDES
22 #include <boost/function.hpp>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/common/owner-pointer.h>
26 #include <dali/internal/common/owner-container.h>
27 #include <dali/public-api/animation/alpha-functions.h>
28 #include <dali/public-api/animation/time-period.h>
29 #include <dali/public-api/common/dali-common.h>
30
31 namespace Dali
32 {
33
34 namespace Internal
35 {
36
37 class Animation;
38 class AnimatorConnectorBase;
39
40 typedef OwnerPointer<AnimatorConnectorBase> AnimatorConnectorPtr;
41
42 typedef OwnerContainer< AnimatorConnectorBase* > AnimatorConnectorContainer;
43
44 typedef AnimatorConnectorContainer::Iterator AnimatorConnectorIter;
45 typedef AnimatorConnectorContainer::ConstIterator AnimatorConnectorConstIter;
46
47 /**
48  * An abstract base class for animator connectors.
49  */
50 class AnimatorConnectorBase
51 {
52 public:
53
54   /**
55    * Constructor.
56    */
57   AnimatorConnectorBase(AlphaFunction alpha, const TimePeriod& period)
58   : mParent(NULL),
59     mAlphaFunction(alpha),
60     mTimePeriod(period)
61   {
62   }
63
64   /**
65    * Virtual destructor.
66    */
67   virtual ~AnimatorConnectorBase()
68   {
69   }
70
71   /**
72    * Set the parent of the AnimatorConnector.
73    * @pre The connector does not already have a parent.
74    * @param [in] parent The parent object.
75    */
76   virtual void SetParent(Animation& parent) = 0;
77
78   /**
79    * Retrieve the parent of the AnimatorConnector.
80    * @return The parent object, or NULL.
81    */
82   Animation* GetParent()
83   {
84     return mParent;
85   }
86
87 protected:
88
89   Animation* mParent; ///< The parent owns the connector.
90
91   AlphaFunction mAlphaFunction;
92   TimePeriod mTimePeriod;
93 };
94
95 } // namespace Internal
96
97 } // namespace Dali
98
99 #endif // __DALI_INTERNAL_ANIMATOR_CONNECTOR_BASE_H__