Merge "Fix resource leaks in layouting." into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / layouting / size-negotiation-mapper.h
1 #ifndef DALI_TOOLKIT_INTERNAL_LAYOUTING_SIZE_NEGOTIATION_MAPPER_IMPL_H
2 #define DALI_TOOLKIT_INTERNAL_LAYOUTING_SIZE_NEGOTIATION_MAPPER_IMPL_H
3
4 /*
5  * Copyright (c) 2018 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 // EXTERNAL HEADERS
21 #include <dali/public-api/actors/actor-enumerations.h>
22 #include <dali-toolkit/public-api/controls/control.h>
23 #include <dali-toolkit/devel-api/layouting/layout-item.h>
24
25 namespace Dali
26 {
27 namespace Toolkit
28 {
29 namespace Internal
30 {
31 using LayoutItemPtr = IntrusivePtr<LayoutItem>;
32 /**
33  *  @brief Maps ResizePolicies used in SizeNegotiation to the Layout system
34  *
35  */
36 namespace SizeNegotiationMapper
37 {
38 /**
39  * @brief Sets the child layout parameters on the control by mapping it's ResizePolicy to a MeasureSpecification
40  * @param[out] control the control to set the layout params on
41  * @param[out] layout the layout for the given control
42  * @param[in] dimension the dimension or dimensions the resize policy applies to.
43  * @note If Dimension::ALL_DIMENSIONS is provided as the dimension parameter then Dimension::WIDTH is used for
44  *       both height and width mapping.
45  */
46 void SetLayoutParametersUsingResizePolicy( Toolkit::Control control, Toolkit::Internal::LayoutItemPtr layout, const Dimension::Type dimension );
47
48 /**
49  * @brief Sets the child layout parameters on the control using the a ResizePolicy that is dependant on it's parent
50  * @param[out] control the control to set the layout params on
51  * @param[in] parentWidthSpecification the parent's width measure specification
52  * @param[in] parentHeightSpecification the parent's height measure specification
53  * @param[out] childWidth the resulting child width
54  * @param[out] childHeight the resulting child height
55  * @note This method should be used after a child has been parented and a parent measure spec is available.
56  */
57 void GetSizeofChildForParentDependentResizePolicy( Toolkit::Control control, const MeasureSpec parentWidthSpecification, const MeasureSpec parentHeightSpecification, LayoutLength& childWidth, LayoutLength& childHeight );
58
59 } // namespace SizeNegotiationMapper
60
61 } // namespace Internal
62
63 } // namespace Toolkit
64
65 } // namespace Dali
66
67
68 #endif // DALI_TOOLKIT_INTERNAL_LAYOUTING_SIZE_NEGOTIATION_MAPPER_IMPL_H