f0e6e00a18ce1c550f46f4b0a324d4ef7c5004f1
[platform/core/uifw/dali-demo.git] / examples / visual-transitions / beat-control.h
1 #ifndef DALI_DEMO_BEAT_CONTROL_H
2 #define DALI_DEMO_BEAT_CONTROL_H
3
4 /*
5  * Copyright (c) 2016 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 #include <dali-toolkit/dali-toolkit.h>
21 #include <string>
22
23 namespace Demo
24 {
25
26 namespace Internal
27 {
28 // All type registered types need to have the same name for the body and the handle
29 class BeatControl;
30 }
31
32 /**
33  * Control that allows the RGB channels of an image to be altered.
34  */
35 class BeatControl : public Dali::Toolkit::Control
36 {
37 public:
38   /**
39    * The start and end property ranges for this control
40    */
41   enum PropertyRange
42   {
43     PROPERTY_START_INDEX = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1,
44     PROPERTY_END_INDEX   = PROPERTY_START_INDEX + 1000,
45     ANIMATABLE_PROPERTY_START_INDEX = Dali::ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX,
46     ANIMATABLE_PROPERTY_END_INDEX = ANIMATABLE_PROPERTY_START_INDEX+1000
47   };
48
49   struct Property
50   {
51     enum
52     {
53       BOUNCE_TRANSITION = PROPERTY_START_INDEX,
54       LEFT_TRANSITION,
55       UP_TRANSITION,
56       FADE_TRANSITION,
57       BEAT_VISUAL
58     };
59   };
60
61 public: // Construction / destruction
62
63   /**
64    * Create an uninitialized handle
65    */
66   BeatControl();
67
68   /**
69    * Create a new image channel control without an image. Use
70    * SetImage to give this control an image
71    */
72   static BeatControl New();
73
74   /**
75    * Create a new image channel control from a given URL
76    */
77   static BeatControl New( const std::string& url );
78
79   /**
80    * Destructor. This is non-virtual since derived Handle types must not
81    * contain data or virtual methods
82    */
83   ~BeatControl();
84
85   /**
86    * Copy Constructor
87    */
88   BeatControl( const BeatControl& beatControl );
89
90   /**
91    * Assignment Operator
92    */
93   BeatControl& operator=( const BeatControl& beatControl );
94
95   /**
96    * Downcast
97    */
98   static BeatControl DownCast( BaseHandle handle );
99
100 public: // API
101
102   void StartBounceAnimation();
103
104   void StartXAnimation();
105
106   void StartYAnimation();
107
108   void StartFadeAnimation();
109
110 public: // Not for public use
111   /**
112    * Create a handle from an implementation
113    */
114   BeatControl( Internal::BeatControl& implementation );
115
116   /**
117    * Allow the creation of an BeatControl handle from an internal CustomActor pointer
118    */
119   BeatControl( Dali::Internal::CustomActor* internal );
120 };
121
122 } // namespace Demo
123
124 #endif // DALI_DEMO_BEAT_CONTROL_H