2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali-toolkit/devel-api/controls/control-wrapper-impl.h>
22 #include <dali/public-api/animation/animation.h>
23 #include <dali-toolkit/public-api/controls/control-impl.h>
24 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
25 #include <dali-toolkit/public-api/styling/style-manager.h>
26 #include <dali-toolkit/internal/styling/style-manager-impl.h>
41 Dali::Toolkit::ControlWrapper ControlWrapper::New( ControlWrapper* controlWrapper )
43 ControlWrapperPtr wrapper( controlWrapper );
45 // Pass ownership to CustomActor via derived handle.
46 Dali::Toolkit::ControlWrapper handle( *wrapper );
48 // Second-phase initialisation of the implementation.
49 // This can only be done after the CustomActor connection has been made.
50 wrapper->Initialize();
55 ControlWrapper::ControlWrapper( CustomControlBehaviour behaviourFlags )
56 : Control( static_cast< ControlBehaviour >( behaviourFlags ) )
60 ControlWrapper::~ControlWrapper()
64 void ControlWrapper::RelayoutRequest()
66 CustomActorImpl::RelayoutRequest();
69 float ControlWrapper::GetHeightForWidthBase( float width )
71 return CustomActorImpl::GetHeightForWidthBase( width );
74 float ControlWrapper::GetWidthForHeightBase( float height )
76 return CustomActorImpl::GetWidthForHeightBase( height );
79 float ControlWrapper::CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension )
81 return CustomActorImpl::CalculateChildSizeBase( child, dimension );
84 bool ControlWrapper::RelayoutDependentOnChildrenBase( Dimension::Type dimension )
86 return CustomActorImpl::RelayoutDependentOnChildrenBase( dimension );
89 void ControlWrapper::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual )
91 Control::RegisterVisual( index, visual );
94 void ControlWrapper::RegisterVisual( Property::Index index, Toolkit::Visual::Base& visual, bool enabled )
96 Control::RegisterVisual( index, visual, enabled );
99 void ControlWrapper::UnregisterVisual( Property::Index index )
101 Control::UnregisterVisual( index );
104 Toolkit::Visual::Base ControlWrapper::GetVisual( Property::Index index ) const
106 return Control::GetVisual( index );
109 void ControlWrapper::EnableVisual( Property::Index index, bool enable )
111 Control::EnableVisual( index, enable );
114 bool ControlWrapper::IsVisualEnabled( Property::Index index ) const
116 return Control::IsVisualEnabled( index );
119 Dali::Animation ControlWrapper::CreateTransition( const Toolkit::TransitionData& handle )
121 return Control::CreateTransition( handle );
124 void ControlWrapper::ApplyThemeStyle()
126 Toolkit::StyleManager styleManager = StyleManager::Get();
128 // if style manager is available
131 StyleManager& styleManagerImpl = GetImpl( styleManager );
133 // Apply the current style
134 styleManagerImpl.ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
138 } // namespace Internal
140 } // namespace Toolkit