[NUI] Fix capture issue of to capture sub-scene. (#1931)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / VisualBase.cs
1 /*
2  * Copyright(c) 2017 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;
19 using System.Runtime.InteropServices;
20 using System.ComponentModel;
21
22 namespace Tizen.NUI
23 {
24
25     /// <summary>
26     /// Sets whether the actor should be focusable by keyboard navigation.<br />
27     /// Visuals reuse geometry, shader etc. across controls. They ensure that the renderer and texture sets exist only when control is on window.<br />
28     /// Each visual also responds to actor size and color change, and provides clipping at the renderer level.<br />
29     /// </summary>
30     /// <since_tizen> 3 </since_tizen>
31     public class VisualBase : BaseHandle
32     {
33
34         /// <summary>
35         /// Creates an empty visual handle.
36         /// </summary>
37         /// <since_tizen> 3 </since_tizen>
38         public VisualBase() : this(Interop.VisualBase.new_VisualBase__SWIG_0(), true)
39         {
40             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
41         }
42
43         internal VisualBase(VisualBase handle) : this(Interop.VisualBase.new_VisualBase__SWIG_1(VisualBase.getCPtr(handle)), true)
44         {
45             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
46         }
47         internal VisualBase(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.VisualBase.VisualBase_SWIGUpcast(cPtr), cMemoryOwn)
48         {
49         }
50
51         /// <summary>
52         /// The name of the visual.
53         /// </summary>
54         /// <since_tizen> 3 </since_tizen>
55         public string Name
56         {
57             set
58             {
59                 SetName(value);
60             }
61             get
62             {
63                 return GetName();
64             }
65         }
66
67         /// <summary>
68         /// The depth index of this visual.
69         /// </summary>
70         /// <since_tizen> 3 </since_tizen>
71         public int DepthIndex
72         {
73             set
74             {
75                 SetDepthIndex(value);
76             }
77             get
78             {
79                 return GetDepthIndex();
80             }
81         }
82
83         /// <summary>
84         /// Creates the property map representing this visual.
85         /// </summary>
86         /// <since_tizen> 3 </since_tizen>
87         public PropertyMap Creation
88         {
89             get
90             {
91                 PropertyMap map = new PropertyMap();
92                 CreatePropertyMap(map);
93                 return map;
94             }
95         }
96
97         /// <summary>
98         /// Sets the transform and the control size.
99         /// </summary>
100         /// <param name="transform">A property map describing the transform.</param>
101         /// <param name="controlSize">The size of the parent control for visuals that need to scale internally.</param>
102         /// <since_tizen> 3 </since_tizen>
103         public void SetTransformAndSize(PropertyMap transform, Vector2 controlSize)
104         {
105             Interop.VisualBase.VisualBase_SetTransformAndSize(swigCPtr, PropertyMap.getCPtr(transform), Vector2.getCPtr(controlSize));
106             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107         }
108
109         /// <summary>
110         /// Returns the height for a given width.
111         /// </summary>
112         /// <param name="width">The width to use.</param>
113         /// <returns>The height based on the width.</returns>
114         /// <since_tizen> 3 </since_tizen>
115         public float GetHeightForWidth(float width)
116         {
117             float ret = Interop.VisualBase.VisualBase_GetHeightForWidth(swigCPtr, width);
118             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119             return ret;
120         }
121
122         /// <summary>
123         /// Returns the width for a given height.
124         /// </summary>
125         /// <param name="height">The height to use.</param>
126         /// <returns>The width based on the height.</returns>
127         /// <since_tizen> 3 </since_tizen>
128         public float GetWidthForHeight(float height)
129         {
130             float ret = Interop.VisualBase.VisualBase_GetWidthForHeight(swigCPtr, height);
131             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
132             return ret;
133         }
134
135         /// <summary>
136         /// Returns the natural size of the visual.<br />
137         /// Deriving classes stipulate the natural size and by default a visual has a zero natural size.<br />
138         /// A visual may not actually have a natural size until it has been placed on window and acquired all it's resources.<br />
139         /// </summary>
140         /// <param name="naturalSize">The visual's natural size.</param>
141         /// <since_tizen> 3 </since_tizen>
142         public void GetNaturalSize(Size2D naturalSize)
143         {
144             Interop.VisualBase.VisualBase_GetNaturalSize(swigCPtr, Size2D.getCPtr(naturalSize));
145             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146         }
147
148         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VisualBase obj)
149         {
150             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
151         }
152
153         internal void SetName(string name)
154         {
155             Interop.VisualBase.VisualBase_SetName(swigCPtr, name);
156             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157         }
158
159         internal string GetName()
160         {
161             string ret = Interop.VisualBase.VisualBase_GetName(swigCPtr);
162             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163             return ret;
164         }
165
166         internal void SetDepthIndex(int index)
167         {
168             Interop.VisualBase.VisualBase_SetDepthIndex(swigCPtr, index);
169             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170         }
171
172         internal int GetDepthIndex()
173         {
174             int ret = Interop.VisualBase.VisualBase_GetDepthIndex(swigCPtr);
175             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176             return ret;
177         }
178
179         internal void CreatePropertyMap(PropertyMap map)
180         {
181             Interop.VisualBase.VisualBase_CreatePropertyMap(swigCPtr, PropertyMap.getCPtr(map));
182             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183         }
184
185         /// This will not be public opened.
186         [EditorBrowsable(EditorBrowsableState.Never)]
187         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
188         {
189             Interop.VisualBase.delete_VisualBase(swigCPtr);
190         }
191     }
192 }