Merge "Add ENABLE_SHIFT_SELECTION property" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / control-devel.cpp
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include "control-devel.h"
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/animation/animation.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
26 #include <dali-toolkit/public-api/controls/control-impl.h>
27 #include <dali-toolkit/devel-api/visual-factory/transition-data.h>
28
29 namespace Dali
30 {
31
32 namespace Toolkit
33 {
34
35 namespace DevelControl
36 {
37
38 void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual )
39 {
40   Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( control );
41   controlDataImpl.RegisterVisual( index, visual );
42 }
43
44 void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, int depthIndex )
45 {
46   Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( control );
47   controlDataImpl.RegisterVisual( index, visual, depthIndex );
48 }
49
50 void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, bool enabled )
51 {
52   Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( control );
53   controlDataImpl.RegisterVisual( index, visual, enabled );
54 }
55
56 void RegisterVisual( Internal::Control& control, Dali::Property::Index index, Toolkit::Visual::Base& visual, bool enabled, int depthIndex )
57 {
58   Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( control );
59   controlDataImpl.RegisterVisual( index, visual, enabled, depthIndex );
60 }
61
62 void UnregisterVisual( Internal::Control& control, Dali::Property::Index index )
63 {
64   Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( control );
65   controlDataImpl.UnregisterVisual( index );
66 }
67
68 Toolkit::Visual::Base GetVisual( const Internal::Control& control, Dali::Property::Index index )
69 {
70   const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( control );
71   return controlDataImpl.GetVisual( index );
72 }
73
74 void EnableVisual( Internal::Control& control, Dali::Property::Index index, bool enable )
75 {
76   Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( control );
77   controlDataImpl.EnableVisual( index, enable );
78 }
79
80 bool IsVisualEnabled( const Internal::Control& control, Dali::Property::Index index )
81 {
82   const Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( control );
83   return controlDataImpl.IsVisualEnabled( index );
84 }
85
86 Dali::Animation CreateTransition( Internal::Control& control, const Toolkit::TransitionData& handle )
87 {
88   Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( control );
89   return controlDataImpl.CreateTransition( handle );
90 }
91
92 void DoAction( Control& control, Dali::Property::Index visualIndex, Dali::Property::Index actionId, const Dali::Property::Value attributes )
93 {
94   Internal::Control& controlInternal = Toolkit::Internal::GetImplementation( control );
95   Internal::Control::Impl& controlDataImpl = Internal::Control::Impl::Get( controlInternal );
96   controlDataImpl.DoAction( visualIndex, actionId, attributes );
97 }
98
99 } // namespace DevelControl
100
101 } // namespace Toolkit
102
103 } // namespace Dali