[NUI] Integreation from dalihub (#988)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Layouting / MeasuredSize.cs
1 /*
2  * Copyright (c) 2019 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 using System.ComponentModel;
19 using Tizen.NUI.BaseComponents;
20
21 namespace Tizen.NUI
22 {
23     /// <summary>
24     /// [Draft] Class that encodes a measurement and a measure state, which is set if the measured size is too small.
25     /// </summary>
26     internal struct MeasuredSize
27     {
28         /// <summary>
29         /// Constructor
30         /// </summary>
31         /// <param name="measuredSize">size parameter</param>
32         /// <param name="state">State</param>
33         public MeasuredSize(LayoutLength measuredSize, MeasuredSize.StateType state)
34         {
35             Size = measuredSize;
36             State = state;
37         }
38
39         /// <summary>
40         /// Creates a MeasuredSize from a LayoutLength
41         /// </summary>
42         /// <param name="measuredSize">LayoutLength to create </param>
43         public static implicit operator MeasuredSize(LayoutLength measuredSize)
44         {
45             return new MeasuredSize(measuredSize, StateType.MeasuredSizeOK);
46         }
47
48         /// <summary>
49         /// LayoutLength size property
50         /// </summary>
51         public LayoutLength Size{ get; set;}
52
53         /// <summary>
54         /// Measured state for this size.
55         /// </summary>
56         public StateType State{ get; set; }
57
58         /// <summary>
59         /// Measured states for a Size value.
60         /// </summary>
61         public enum StateType
62         {
63             /// <summary>
64             /// The measured size is good
65             /// </summary>
66             MeasuredSizeOK,
67             /// <summary>
68             /// The measured size is too small
69             /// </summary>
70             MeasuredSizeTooSmall
71         }
72     }
73 }