Exporting one constructor used by csharpbinder and making an API private.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / layouting / layout-item.h
1 #ifndef DALI_TOOLKIT_LAYOUTING_LAYOUT_ITEM_H
2 #define DALI_TOOLKIT_LAYOUTING_LAYOUT_ITEM_H
3 /*
4  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 #include <memory>
20 #include <cstdint>
21 #include <dali/public-api/common/dali-common.h>
22 #include <dali/public-api/actors/actor-enumerations.h>
23 #include <dali/public-api/object/base-handle.h>
24 #include <dali/public-api/object/property-index-ranges.h>
25 #include <dali-toolkit/devel-api/layouting/child-layout-data.h>
26 #include <dali-toolkit/devel-api/layouting/measure-spec.h>
27
28 namespace Dali
29 {
30 namespace Toolkit
31 {
32
33 namespace Internal
34 {
35 class LayoutItem;
36 }
37
38 using LayoutId = unsigned int;
39
40
41 /**
42  * Base class for layouts. It is used to layout a control (or visual).
43  * It can be laid out by a LayoutGroup.
44  */
45 class DALI_IMPORT_API LayoutItem : public BaseHandle
46 {
47 public:
48
49   enum PropertyRange
50   {
51     CHILD_PROPERTY_START_INDEX = CHILD_PROPERTY_REGISTRATION_START_INDEX, ///< Start index is used by child properties
52     CHILD_PROPERTY_END_INDEX   = CHILD_PROPERTY_REGISTRATION_START_INDEX+1000 ///< Reserving 1000 property indices
53   };
54
55   struct ChildProperty
56   {
57     enum
58     {
59       WIDTH_SPECIFICATION = ///< Child property to specify desired width (May use MATCH_PARENT/WRAP_CONTENT)
60         CHILD_PROPERTY_START_INDEX,
61       HEIGHT_SPECIFICATION ///< Child property to specify desired height (May use MATCH_PARENT/WRAP_CONTENT)
62     };
63   };
64
65   /**
66    * @brief Default constructor which provides an uninitialized Dali::LayoutItem.
67    */
68   LayoutItem();
69
70   /**
71    * @brief Default destructor
72    */
73   ~LayoutItem()=default;
74
75   /**
76    * @brief Create an initialized LayoutItem
77    *
78    * @param[in] handle A handle to the object that this layout for, e.g. a Control or a Visual::Base
79    * @warning This is an interim function, and will be deleted when all controls have layouts
80    * @todo Ensure that this warning is implemented
81    */
82   static LayoutItem New( Handle& handle );
83
84   /**
85    * @brief Copy constructor
86    * @param[in] copy The LayoutItem to copy.
87    */
88   LayoutItem(const LayoutItem& copy) = default;
89
90   /**
91    * @brief Assignment operator
92    * @param[in] rhs The LayoutItem to copy
93    */
94   LayoutItem& operator=( const LayoutItem& rhs ) = default;
95
96   /**
97    * @brief Get a handle to the control or visual this layout represents.
98    *
99    * @return
100    */
101   Handle GetOwner() const;
102
103   /**
104    * @brief Set whether this layout should be animated or not
105    *
106    * @param[in] animateLayout True if the layout should be animated when applied
107    */
108   void SetAnimateLayout( bool animateLayout );
109
110   /**
111    * @brief Predicate to determine whether this layout should be animated when applied
112    *
113    * @return True if the layout should be animated when applied
114    */
115   bool IsLayoutAnimated() const;
116
117 public:
118   /// @cond internal
119   /**
120    * @brief This constructor is used by LayoutItem::New() methods.
121    *
122    * @param[in] actor A pointer to a newly allocated Dali resource
123    */
124   explicit LayoutItem( Internal::LayoutItem* LayoutItem );
125   /// @endcond
126 };
127
128
129 }//namespace Toolkit
130 }//namespace Dali
131
132 #endif // DALI_TOOLKIT_LAYOUTING_LAYOUT_ITEM_H