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;
25 /// Sets whether the actor should be focusable by keyboard navigation.<br />
26 /// Visuals reuse geometry, shader etc. across controls. They ensure that the renderer and texture sets exist only when control is on window.<br />
27 /// Each visual also responds to actor size and color change, and provides clipping at the renderer level.<br />
29 public class VisualBase : BaseHandle
31 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
33 internal VisualBase(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.VisualBase_SWIGUpcast(cPtr), cMemoryOwn)
35 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
38 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VisualBase obj)
40 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
46 /// <param name="type">The dispose type</param>
47 /// <since_tizen> 3 </since_tizen>
48 protected override void Dispose(DisposeTypes type)
55 if(type == DisposeTypes.Explicit)
58 //Release your own managed resources here.
59 //You should release all of your own disposable objects here.
62 //Release your own unmanaged resources here.
63 //You should not access any managed member here except static instance.
64 //because the execution order of Finalizes is non-deterministic.
66 if (swigCPtr.Handle != global::System.IntPtr.Zero)
71 NDalicPINVOKE.delete_VisualBase(swigCPtr);
73 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
80 /// Creates an empty visual handle.
82 /// <since_tizen> 3 </since_tizen>
83 public VisualBase() : this(NDalicPINVOKE.new_VisualBase__SWIG_0(), true)
85 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
88 internal VisualBase(VisualBase handle) : this(NDalicPINVOKE.new_VisualBase__SWIG_1(VisualBase.getCPtr(handle)), true)
90 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
94 /// The name of the visual.
96 /// <since_tizen> 3 </since_tizen>
109 internal void SetName(string name)
111 NDalicPINVOKE.VisualBase_SetName(swigCPtr, name);
112 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
115 internal string GetName()
117 string ret = NDalicPINVOKE.VisualBase_GetName(swigCPtr);
118 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 /// Sets the transform and the control size.
125 /// <param name="transform">A property map describing the transform.</param>
126 /// <param name="controlSize">The size of the parent control for visuals that need to scale internally.</param>
127 /// <since_tizen> 3 </since_tizen>
128 public void SetTransformAndSize(PropertyMap transform, Vector2 controlSize)
130 NDalicPINVOKE.VisualBase_SetTransformAndSize(swigCPtr, PropertyMap.getCPtr(transform), Vector2.getCPtr(controlSize));
131 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135 /// Returns the height for a given width.
137 /// <param name="width">The width to use.</param>
138 /// <returns>The height based on the width.</returns>
139 /// <since_tizen> 3 </since_tizen>
140 public float GetHeightForWidth(float width)
142 float ret = NDalicPINVOKE.VisualBase_GetHeightForWidth(swigCPtr, width);
143 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148 /// Returns the width for a given height.
150 /// <param name="height">The height to use.</param>
151 /// <returns>The width based on the height.</returns>
152 /// <since_tizen> 3 </since_tizen>
153 public float GetWidthForHeight(float height)
155 float ret = NDalicPINVOKE.VisualBase_GetWidthForHeight(swigCPtr, height);
156 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
161 /// Returns the natural size of the visual.<br />
162 /// Deriving classes stipulate the natural size and by default a visual has a zero natural size.<br />
163 /// A visual may not actually have a natural size until it has been placed on window and acquired all it's resources.<br />
165 /// <param name="naturalSize">The visual's natural size.</param>
166 /// <since_tizen> 3 </since_tizen>
167 public void GetNaturalSize(Size2D naturalSize)
169 NDalicPINVOKE.VisualBase_GetNaturalSize(swigCPtr, Size2D.getCPtr(naturalSize));
170 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174 /// The depth index of this visual.
176 /// <since_tizen> 3 </since_tizen>
177 public int DepthIndex
181 SetDepthIndex(value);
185 return GetDepthIndex();
188 internal void SetDepthIndex(int index)
190 NDalicPINVOKE.VisualBase_SetDepthIndex(swigCPtr, index);
191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
194 internal int GetDepthIndex()
196 int ret = NDalicPINVOKE.VisualBase_GetDepthIndex(swigCPtr);
197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202 /// Creates the property map representing this visual.
204 [Obsolete("Please be caution! this will be readonly.")]
205 public PropertyMap Creation
209 CreatePropertyMap(value);
213 PropertyMap map = new PropertyMap();
214 CreatePropertyMap(map);
219 internal void CreatePropertyMap(PropertyMap map)
221 NDalicPINVOKE.VisualBase_CreatePropertyMap(swigCPtr, PropertyMap.getCPtr(map));
222 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
225 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)
227 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();