Merge "Clean up the code to build successfully on macOS" into devel/master
[platform/core/uifw/dali-core.git] / dali / public-api / actors / custom-actor-impl.cpp
1 /*
2  * Copyright (c) 2020 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 <dali/public-api/actors/custom-actor-impl.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/actors/custom-actor-internal.h>
23 #include <dali/public-api/common/dali-common.h>
24
25 namespace Dali
26 {
27 CustomActor CustomActorImpl::Self() const
28 {
29   return CustomActor(mOwner);
30 }
31
32 void CustomActorImpl::OnPropertySet(Property::Index index, const Property::Value& propertyValue)
33 {
34 }
35
36 CustomActorImpl::CustomActorImpl(ActorFlags flags)
37 : mOwner(nullptr),
38   mFlags(flags)
39 {
40 }
41
42 CustomActorImpl::~CustomActorImpl() = default;
43
44 void CustomActorImpl::Initialize(Internal::CustomActor& owner)
45 {
46   DALI_ASSERT_DEBUG(mOwner == NULL); // should not already be owned
47
48   mOwner = &owner;
49 }
50
51 Internal::CustomActor* CustomActorImpl::GetOwner() const
52 {
53   return mOwner;
54 }
55
56 bool CustomActorImpl::IsRelayoutEnabled() const
57 {
58   return (mFlags & DISABLE_SIZE_NEGOTIATION) == 0;
59 }
60
61 void CustomActorImpl::RelayoutRequest()
62 {
63   mOwner->RelayoutRequest();
64 }
65
66 float CustomActorImpl::GetHeightForWidthBase(float width)
67 {
68   return mOwner->GetHeightForWidthBase(width);
69 }
70
71 float CustomActorImpl::GetWidthForHeightBase(float height)
72 {
73   return mOwner->GetWidthForHeightBase(height);
74 }
75
76 float CustomActorImpl::CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension)
77 {
78   return mOwner->CalculateChildSizeBase(child, dimension);
79 }
80
81 bool CustomActorImpl::RelayoutDependentOnChildrenBase(Dimension::Type dimension)
82 {
83   return mOwner->RelayoutDependentOnChildrenBase(dimension);
84 }
85
86 } // namespace Dali