[NUI] Add NUI-Layout (#293)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Layouting / LayoutItemWrapper.cs
1 /*
2  * Copyright (c) 2018 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     /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
24     [EditorBrowsable(EditorBrowsableState.Never)]
25     public class LayoutItemWrapper : BaseHandle
26     {
27         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
28         internal LayoutItemWrapperImpl layoutItemWrapperImpl;
29
30         internal LayoutItemWrapper(global::System.IntPtr cPtr, bool cMemoryOwn) : base(LayoutPINVOKE.LayoutItemWrapper_SWIGUpcast(cPtr), cMemoryOwn)
31         {
32             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
33         }
34
35         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LayoutItemWrapper obj)
36         {
37             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
38         }
39
40         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
41         [EditorBrowsable(EditorBrowsableState.Never)]
42         protected override void Dispose(DisposeTypes type)
43         {
44             if (disposed)
45             {
46                 return;
47             }
48
49             if (type == DisposeTypes.Explicit)
50             {
51                 //Called by User
52                 //Release your own managed resources here.
53                 //You should release all of your own disposable objects here.
54
55             }
56
57             //Release your own unmanaged resources here.
58             //You should not access any managed member here except static instance.
59             //because the execution order of Finalizes is non-deterministic.
60
61             if (swigCPtr.Handle != global::System.IntPtr.Zero)
62             {
63                 if (swigCMemOwn)
64                 {
65                     swigCMemOwn = false;
66                     LayoutPINVOKE.delete_LayoutItemWrapper(swigCPtr);
67                 }
68                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
69             }
70
71             base.Dispose();
72         }
73
74         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
75         [EditorBrowsable(EditorBrowsableState.Never)]
76         public class ChildProperty
77         {
78             public static readonly int WIDTH_SPECIFICATION = LayoutPINVOKE.LayoutItemWrapper_ChildProperty_WIDTH_SPECIFICATION_get();
79             public static readonly int HEIGHT_SPECIFICATION = LayoutPINVOKE.LayoutItemWrapper_ChildProperty_HEIGHT_SPECIFICATION_get();
80
81         }
82
83         /*public LayoutItemWrapper (Handle handle) : this (LayoutPINVOKE.LayoutItemWrapper_New(Handle.getCPtr(handle)), true)
84         {
85             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86         }*/
87
88         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
89         [EditorBrowsable(EditorBrowsableState.Never)]
90         public View GetOwner()
91         {
92             global::System.IntPtr cPtr = LayoutPINVOKE.LayoutItemWrapper_GetOwner(swigCPtr);
93             View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View;
94             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
95             return ret;
96         }
97
98         private void SetAnimateLayout(bool animateLayout)
99         {
100             LayoutPINVOKE.LayoutItemWrapper_SetAnimateLayout(swigCPtr, animateLayout);
101             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102         }
103
104         private bool IsLayoutAnimated()
105         {
106             bool ret = LayoutPINVOKE.LayoutItemWrapper_IsLayoutAnimated(swigCPtr);
107             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108             return ret;
109         }
110
111         /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
112         [EditorBrowsable(EditorBrowsableState.Never)]
113         public bool LayoutAnimate
114         {
115             get
116             {
117                 return IsLayoutAnimated();
118             }
119             set
120             {
121                 SetAnimateLayout(value);
122             }
123         }
124
125         internal LayoutItemWrapper(LayoutItemWrapperImpl implementation) : this(LayoutPINVOKE.new_LayoutItemWrapper__SWIG_2(LayoutItemWrapperImpl.getCPtr(implementation)), true)
126         {
127             layoutItemWrapperImpl = implementation;
128             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129         }
130     }
131
132
133     /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
134     [EditorBrowsable(EditorBrowsableState.Never)]
135     public interface ILayoutParent
136     {
137         ILayoutParent GetParent();
138         /*{
139             global::System.IntPtr cPtr = LayoutPINVOKE.LayoutParent_GetParent(swigCPtr);
140             LayoutParent ret = (cPtr == global::System.IntPtr.Zero) ? null : new LayoutParent(cPtr, false);
141             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142             return ret;
143         }*/
144     }
145 }