2 * Copyright(c) 2021 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.
18 using System.ComponentModel;
24 /// Sets whether the actor should be focusable by keyboard navigation.<br />
25 /// Visuals reuse geometry, shader etc. across controls. They ensure that the renderer and texture sets exist only when control is on window.<br />
26 /// Each visual also responds to actor size and color change, and provides clipping at the renderer level.<br />
28 /// <since_tizen> 3 </since_tizen>
29 public class VisualBase : BaseHandle
33 /// Creates an empty visual handle.
35 /// <since_tizen> 3 </since_tizen>
36 public VisualBase() : this(Interop.VisualBase.NewVisualBase(), true)
38 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
41 internal VisualBase(VisualBase handle) : this(Interop.VisualBase.NewVisualBase(VisualBase.getCPtr(handle)), true)
43 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
45 internal VisualBase(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
50 /// The name of the visual.
52 /// <since_tizen> 3 </since_tizen>
66 /// The depth index of this visual.
68 /// <since_tizen> 3 </since_tizen>
77 return GetDepthIndex();
82 /// Creates the property map representing this visual.
84 /// <since_tizen> 3 </since_tizen>
85 public PropertyMap Creation
89 PropertyMap map = new PropertyMap();
90 CreatePropertyMap(map);
96 /// Sets the transform and the control size.
98 /// <param name="transform">A property map describing the transform.</param>
99 /// <param name="controlSize">The size of the parent control for visuals that need to scale internally.</param>
100 /// <since_tizen> 3 </since_tizen>
101 public void SetTransformAndSize(PropertyMap transform, Vector2 controlSize)
103 Interop.VisualBase.SetTransformAndSize(SwigCPtr, PropertyMap.getCPtr(transform), Vector2.getCPtr(controlSize));
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
108 /// Returns the height for a given width.
110 /// <param name="width">The width to use.</param>
111 /// <returns>The height based on the width.</returns>
112 /// <since_tizen> 3 </since_tizen>
113 public float GetHeightForWidth(float width)
115 float ret = Interop.VisualBase.GetHeightForWidth(SwigCPtr, width);
116 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121 /// Returns the width for a given height.
123 /// <param name="height">The height to use.</param>
124 /// <returns>The width based on the height.</returns>
125 /// <since_tizen> 3 </since_tizen>
126 public float GetWidthForHeight(float height)
128 float ret = Interop.VisualBase.GetWidthForHeight(SwigCPtr, height);
129 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
134 /// Returns the natural size of the visual.<br />
135 /// Deriving classes stipulate the natural size and by default a visual has a zero natural size.<br />
136 /// A visual may not actually have a natural size until it has been placed on window and acquired all it's resources.<br />
138 /// <param name="naturalSize">The visual's natural size.</param>
139 /// <since_tizen> 3 </since_tizen>
140 public void GetNaturalSize(Size2D naturalSize)
142 Interop.VisualBase.GetNaturalSize(SwigCPtr, Size2D.getCPtr(naturalSize));
143 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VisualBase obj)
148 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
151 internal void SetName(string name)
153 Interop.VisualBase.SetName(SwigCPtr, name);
154 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157 internal string GetName()
159 string ret = Interop.VisualBase.GetName(SwigCPtr);
160 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
164 internal void SetDepthIndex(int index)
166 Interop.VisualBase.SetDepthIndex(SwigCPtr, index);
167 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170 internal int GetDepthIndex()
172 int ret = Interop.VisualBase.GetDepthIndex(SwigCPtr);
173 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
177 internal void CreatePropertyMap(PropertyMap map)
179 Interop.VisualBase.CreatePropertyMap(SwigCPtr, PropertyMap.getCPtr(map));
180 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183 /// This will not be public opened.
184 [EditorBrowsable(EditorBrowsableState.Never)]
185 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
187 Interop.VisualBase.DeleteVisualBase(swigCPtr);