c9a29e4516d63ddd46e38d216f9af0066ca92232
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / test-button.h
1 #ifndef DALI_TOOLKIT_TEST_TEST_BUTTON_H
2 #define DALI_TOOLKIT_TEST_TEST_BUTTON_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 <test-animation-data.h>
22
23 namespace Test
24 {
25 namespace Impl
26 {
27 class TestButton;
28 }
29
30 class TestButton : public Dali::Toolkit::Control
31 {
32 public:
33   enum PropertyRange
34   {
35     PROPERTY_START_INDEX = Dali::Toolkit::Control::CONTROL_PROPERTY_END_INDEX + 1,
36     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000
37   };
38   struct Property
39   {
40     enum
41     {
42       PRESS_TRANSITION = PROPERTY_START_INDEX,
43       RELEASE_TRANSITION,
44       DISABLED_TRANSITION,
45       ENABLED_TRANSITION,
46       BACKGROUND_COLOR,
47       FOREGROUND_COLOR
48     };
49   };
50   TestButton();
51   TestButton(const TestButton& button);
52   TestButton(Impl::TestButton& impl);
53   TestButton(Dali::Internal::CustomActor* internal);
54   TestButton& operator=( const TestButton& button);
55   ~TestButton();
56   static TestButton New();
57   static TestButton DownCast( Dali::BaseHandle handle );
58 };
59
60 namespace Impl
61 {
62
63 class TestButton : public Dali::Toolkit::Internal::Control
64 {
65 public:
66   static Test::TestButton New();
67
68   static void SetProperty( Dali::BaseObject* object,
69                            Dali::Property::Index index,
70                            const Dali::Property::Value& value );
71
72   static Dali::Property::Value GetProperty( Dali::BaseObject* object,
73                                             Dali::Property::Index propertyIndex );
74
75 protected:
76   TestButton();
77   virtual ~TestButton();
78
79 public:
80   Test::TestAnimationData mPressTransitionData;
81   Test::TestAnimationData mReleaseTransitionData;
82   Test::TestAnimationData mDisabledTransitionData;
83   Test::TestAnimationData mEnabledTransitionData;
84   Dali::Vector4 mBackgroundColor;
85   Dali::Vector4 mForegroundColor;
86 };
87
88 inline TestButton& GetImpl( Test::TestButton& handle )
89 {
90   DALI_ASSERT_ALWAYS( handle );
91   Dali::RefObject& object = handle.GetImplementation();
92   return static_cast<TestButton&>( object );
93 }
94
95 inline const TestButton& GetImpl( const Test::TestButton& handle )
96 {
97   DALI_ASSERT_ALWAYS( handle );
98   const Dali::RefObject& object = handle.GetImplementation();
99   return static_cast<const TestButton&>( object );
100 }
101
102 } // Impl
103 } // Test
104
105
106
107 #endif // DALI_TOOLKIT_TEST_TEST_BUTTON_H