1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
21 /// Sets whether the actor should be focusable by keyboard navigation.<br>
22 /// Visuals reuse geometry, shader etc. across controls. They ensure that the renderer and texture sets exist only when control is on-window.<br>
23 /// Each visual also responds to actor size and color change, and provides clipping at the renderer level.<br>
25 public class VisualBase : BaseHandle
27 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
29 internal VisualBase(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.VisualBase_SWIGUpcast(cPtr), cMemoryOwn)
31 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
34 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VisualBase obj)
36 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
39 protected override void Dispose(DisposeTypes type)
46 if(type == DisposeTypes.Explicit)
49 //Release your own managed resources here.
50 //You should release all of your own disposable objects here.
53 //Release your own unmanaged resources here.
54 //You should not access any managed member here except static instance.
55 //because the execution order of Finalizes is non-deterministic.
57 if (swigCPtr.Handle != global::System.IntPtr.Zero)
62 NDalicPINVOKE.delete_VisualBase(swigCPtr);
64 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
71 /// Create an empty Visual Handle
73 public VisualBase() : this(NDalicPINVOKE.new_VisualBase__SWIG_0(), true)
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
78 internal VisualBase(VisualBase handle) : this(NDalicPINVOKE.new_VisualBase__SWIG_1(VisualBase.getCPtr(handle)), true)
80 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
84 /// name of the visual
98 internal void SetName(string name)
100 NDalicPINVOKE.VisualBase_SetName(swigCPtr, name);
101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104 internal string GetName()
106 string ret = NDalicPINVOKE.VisualBase_GetName(swigCPtr);
107 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112 /// Sets the transform and the control size
114 /// <param name="transform">A property map describing the transform</param>
115 /// <param name="controlSize">The size of the parent control for visuals that need to scale internally.</param>
116 public void SetTransformAndSize(PropertyMap transform, Vector2 controlSize)
118 NDalicPINVOKE.VisualBase_SetTransformAndSize(swigCPtr, PropertyMap.getCPtr(transform), Vector2.getCPtr(controlSize));
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
123 /// Returns the height for a given width.
125 /// <param name="width">Width to use.</param>
126 /// <returns>The height based on the width.</returns>
127 public float GetHeightForWidth(float width)
129 float ret = NDalicPINVOKE.VisualBase_GetHeightForWidth(swigCPtr, width);
130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135 /// Returns the width for a given height.
137 /// <param name="height">Height to use.</param>
138 /// <returns>The width based on the height.</returns>
139 public float GetWidthForHeight(float height)
141 float ret = NDalicPINVOKE.VisualBase_GetWidthForHeight(swigCPtr, height);
142 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147 /// Return the natural size of the visual.<br>
148 /// Deriving classes stipulate the natural size and by default a visual has a ZERO natural size.<br>
149 /// A visual may not actually have a natural size until it has been placed on window and acquired all it's resources.<br>
151 /// <param name="naturalSize">The visual's natural size</param>
152 public void GetNaturalSize(Size2D naturalSize)
154 NDalicPINVOKE.VisualBase_GetNaturalSize(swigCPtr, Size2D.getCPtr(naturalSize));
155 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159 /// the depth index of this visual.
161 public int DepthIndex
165 SetDepthIndex(value);
169 return GetDepthIndex();
172 internal void SetDepthIndex(int index)
174 NDalicPINVOKE.VisualBase_SetDepthIndex(swigCPtr, index);
175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178 internal int GetDepthIndex()
180 int ret = NDalicPINVOKE.VisualBase_GetDepthIndex(swigCPtr);
181 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186 /// Create the property map representing this visual.
188 public PropertyMap Creation
192 CreatePropertyMap(value);
195 internal void CreatePropertyMap(PropertyMap map)
197 NDalicPINVOKE.VisualBase_CreatePropertyMap(swigCPtr, PropertyMap.getCPtr(map));
198 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
201 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)
203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();