2 * Copyright(c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 using System.Runtime.InteropServices;
20 using System.ComponentModel;
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 />
30 /// <since_tizen> 3 </since_tizen>
31 public class VisualBase : BaseHandle
33 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
35 internal VisualBase(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.VisualBase_SWIGUpcast(cPtr), cMemoryOwn)
37 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
40 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VisualBase obj)
42 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
48 /// <param name="type">The dispose type</param>
49 /// <since_tizen> 3 </since_tizen>
50 protected override void Dispose(DisposeTypes type)
57 if(type == DisposeTypes.Explicit)
60 //Release your own managed resources here.
61 //You should release all of your own disposable objects here.
64 //Release your own unmanaged resources here.
65 //You should not access any managed member here except static instance.
66 //because the execution order of Finalizes is non-deterministic.
68 if (swigCPtr.Handle != global::System.IntPtr.Zero)
73 NDalicPINVOKE.delete_VisualBase(swigCPtr);
75 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
82 /// Creates an empty visual handle.
84 /// <since_tizen> 3 </since_tizen>
85 public VisualBase() : this(NDalicPINVOKE.new_VisualBase__SWIG_0(), true)
87 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
90 internal VisualBase(VisualBase handle) : this(NDalicPINVOKE.new_VisualBase__SWIG_1(VisualBase.getCPtr(handle)), true)
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
96 /// The name of the visual.
98 /// <since_tizen> 3 </since_tizen>
111 internal void SetName(string name)
113 NDalicPINVOKE.VisualBase_SetName(swigCPtr, name);
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 internal string GetName()
119 string ret = NDalicPINVOKE.VisualBase_GetName(swigCPtr);
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
125 /// Sets the transform and the control size.
127 /// <param name="transform">A property map describing the transform.</param>
128 /// <param name="controlSize">The size of the parent control for visuals that need to scale internally.</param>
129 /// <since_tizen> 3 </since_tizen>
130 public void SetTransformAndSize(PropertyMap transform, Vector2 controlSize)
132 NDalicPINVOKE.VisualBase_SetTransformAndSize(swigCPtr, PropertyMap.getCPtr(transform), Vector2.getCPtr(controlSize));
133 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
137 /// Returns the height for a given width.
139 /// <param name="width">The width to use.</param>
140 /// <returns>The height based on the width.</returns>
141 /// <since_tizen> 3 </since_tizen>
142 public float GetHeightForWidth(float width)
144 float ret = NDalicPINVOKE.VisualBase_GetHeightForWidth(swigCPtr, width);
145 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
150 /// Returns the width for a given height.
152 /// <param name="height">The height to use.</param>
153 /// <returns>The width based on the height.</returns>
154 /// <since_tizen> 3 </since_tizen>
155 public float GetWidthForHeight(float height)
157 float ret = NDalicPINVOKE.VisualBase_GetWidthForHeight(swigCPtr, height);
158 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
163 /// Returns the natural size of the visual.<br />
164 /// Deriving classes stipulate the natural size and by default a visual has a zero natural size.<br />
165 /// A visual may not actually have a natural size until it has been placed on window and acquired all it's resources.<br />
167 /// <param name="naturalSize">The visual's natural size.</param>
168 /// <since_tizen> 3 </since_tizen>
169 public void GetNaturalSize(Size2D naturalSize)
171 NDalicPINVOKE.VisualBase_GetNaturalSize(swigCPtr, Size2D.getCPtr(naturalSize));
172 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176 /// The depth index of this visual.
178 /// <since_tizen> 3 </since_tizen>
179 public int DepthIndex
183 SetDepthIndex(value);
187 return GetDepthIndex();
190 internal void SetDepthIndex(int index)
192 NDalicPINVOKE.VisualBase_SetDepthIndex(swigCPtr, index);
193 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 internal int GetDepthIndex()
198 int ret = NDalicPINVOKE.VisualBase_GetDepthIndex(swigCPtr);
199 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204 /// Creates the property map representing this visual.
206 /// <since_tizen> 3 </since_tizen>
207 [Obsolete("Please be caution! this will be readonly.")]
208 [EditorBrowsable(EditorBrowsableState.Never)]
209 public PropertyMap Creation
213 CreatePropertyMap(value);
217 PropertyMap map = new PropertyMap();
218 CreatePropertyMap(map);
223 internal void CreatePropertyMap(PropertyMap map)
225 NDalicPINVOKE.VisualBase_CreatePropertyMap(swigCPtr, PropertyMap.getCPtr(map));
226 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
229 internal VisualBase(SWIGTYPE_p_Dali__Toolkit__Internal__Visual__Base impl) : this(NDalicPINVOKE.new_VisualBase__SWIG_2(SWIGTYPE_p_Dali__Toolkit__Internal__Visual__Base.getCPtr(impl)), true)
231 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();