Move more public-api headers to devel-api. PART 2
[platform/core/uifw/dali-demo.git] / examples / radial-menu / radial-sweep-view-impl.h
1 #ifndef DALI_DEMO_RADIAL_SWEEP_VIEW_IMPL_H
2 #define DALI_DEMO_RADIAL_SWEEP_VIEW_IMPL_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 #include <dali-toolkit/dali-toolkit.h>
22 #include <dali/devel-api/actors/mesh-actor.h>
23 #include <dali/devel-api/modeling/material.h>
24 #include <dali/devel-api/geometry/animatable-mesh.h>
25
26 #include "radial-sweep-view.h"
27
28
29 /********************************************************************************
30  * Class to implement a layer with a radial sweep stencil mask and an actor tree
31  */
32 class RadialSweepViewImpl : public Dali::Toolkit::Internal::Control
33 {
34 public:
35   static RadialSweepView New();
36
37   static RadialSweepView New( float duration,
38                               float diameter,
39                               Dali::Degree initialAngle,
40                               Dali::Degree finalAngle,
41                               Dali::Degree initialSector,
42                               Dali::Degree finalSector );
43
44   RadialSweepViewImpl( float duration,
45                        float diameter,
46                        Dali::Degree initialAngle,
47                        Dali::Degree finalAngle,
48                        Dali::Degree initialSector,
49                        Dali::Degree finalSector );
50
51   void SetDuration(float duration);
52   void SetEasingFunction( Dali::AlphaFunction easingFunction );
53
54   void SetDiameter(float diameter);
55   void SetInitialAngle( Dali::Degree initialAngle);
56   void SetFinalAngle( Dali::Degree finalAngle);
57   void SetInitialSector( Dali::Degree initialSector);
58   void SetFinalSector( Dali::Degree finalSector);
59   void SetInitialActorAngle( Dali::Degree initialAngle );
60   void SetFinalActorAngle( Dali::Degree finalAngle );
61
62   float GetDuration( );
63   float GetDiameter( );
64   Dali::Degree GetInitialAngle( );
65   Dali::Degree GetFinalAngle( );
66   Dali::Degree GetInitialSector( );
67   Dali::Degree GetFinalSector( );
68   Dali::Degree GetInitialActorAngle( );
69   Dali::Degree GetFinalActorAngle( );
70
71   void RotateActorsWithStencil(bool rotate);
72
73   void Add( Dali::Actor actor );
74
75   void Activate( Dali::Animation anim = Dali::Animation(), float offsetTime=0, float duration=2.0f );
76
77   void Deactivate();
78
79 private:
80
81   /**
82    * Create the stencil mask
83    */
84   void CreateStencil(Dali::Degree initialSector );
85
86 private:
87   Dali::Layer           mLayer;
88   Dali::Animation       mAnim;
89   float                 mDuration;
90   float                 mDiameter;
91   Dali::Degree          mInitialAngle;
92   Dali::Degree          mFinalAngle;
93   Dali::Degree          mInitialSector;
94   Dali::Degree          mFinalSector;
95   Dali::Degree          mInitialActorAngle;
96   Dali::Degree          mFinalActorAngle;
97   Dali::AlphaFunction   mEasingFunction;
98   Dali::MeshActor       mStencilActor;       ///< Stencil actor which generates mask
99   Dali::Material        mMaterial;           ///< Material for drawing mesh actor
100   Dali::AnimatableMesh  mMesh;               ///< Animatable mesh
101   Dali::Property::Index mStartAngleIndex;    ///< Index of start-angle property
102   Dali::Property::Index mRotationAngleIndex; ///< Index of rotation-angle property
103   bool                  mRotateActorsWithStencil:1;
104   bool                  mRotateActors;
105 };
106
107
108 inline RadialSweepViewImpl& GetImpl( RadialSweepView& obj )
109 {
110   DALI_ASSERT_ALWAYS(obj);
111   Dali::RefObject& handle = obj.GetImplementation();
112   return static_cast<RadialSweepViewImpl&>(handle);
113 }
114
115 inline const RadialSweepViewImpl& GetImpl( const RadialSweepView& obj )
116 {
117   DALI_ASSERT_ALWAYS(obj);
118   const Dali::RefObject& handle = obj.GetImplementation();
119   return static_cast<const RadialSweepViewImpl&>(handle);
120 }
121
122
123
124 #endif // DALI_DEMO_RADIAL_SWEEP_VIEW_IMPL_H