/* * Copyright(c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using System; using System.Runtime.InteropServices; using System.ComponentModel; namespace Tizen.NUI { /// /// Sets whether the actor should be focusable by keyboard navigation.
/// Visuals reuse geometry, shader etc. across controls. They ensure that the renderer and texture sets exist only when control is on window.
/// Each visual also responds to actor size and color change, and provides clipping at the renderer level.
///
/// 3 public class VisualBase : BaseHandle { /// /// Creates an empty visual handle. /// /// 3 public VisualBase() : this(Interop.VisualBase.NewVisualBase(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal VisualBase(VisualBase handle) : this(Interop.VisualBase.NewVisualBase(VisualBase.getCPtr(handle)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal VisualBase(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.VisualBase.Upcast(cPtr), cMemoryOwn) { } /// /// The name of the visual. /// /// 3 public string Name { set { SetName(value); } get { return GetName(); } } /// /// The depth index of this visual. /// /// 3 public int DepthIndex { set { SetDepthIndex(value); } get { return GetDepthIndex(); } } /// /// Creates the property map representing this visual. /// /// 3 public PropertyMap Creation { get { PropertyMap map = new PropertyMap(); CreatePropertyMap(map); return map; } } /// /// Sets the transform and the control size. /// /// A property map describing the transform. /// The size of the parent control for visuals that need to scale internally. /// 3 public void SetTransformAndSize(PropertyMap transform, Vector2 controlSize) { Interop.VisualBase.SetTransformAndSize(SwigCPtr, PropertyMap.getCPtr(transform), Vector2.getCPtr(controlSize)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// Returns the height for a given width. /// /// The width to use. /// The height based on the width. /// 3 public float GetHeightForWidth(float width) { float ret = Interop.VisualBase.GetHeightForWidth(SwigCPtr, width); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Returns the width for a given height. /// /// The height to use. /// The width based on the height. /// 3 public float GetWidthForHeight(float height) { float ret = Interop.VisualBase.GetWidthForHeight(SwigCPtr, height); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Returns the natural size of the visual.
/// Deriving classes stipulate the natural size and by default a visual has a zero natural size.
/// A visual may not actually have a natural size until it has been placed on window and acquired all it's resources.
///
/// The visual's natural size. /// 3 public void GetNaturalSize(Size2D naturalSize) { Interop.VisualBase.GetNaturalSize(SwigCPtr, Size2D.getCPtr(naturalSize)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VisualBase obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr; } internal void SetName(string name) { Interop.VisualBase.SetName(SwigCPtr, name); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal string GetName() { string ret = Interop.VisualBase.GetName(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal void SetDepthIndex(int index) { Interop.VisualBase.SetDepthIndex(SwigCPtr, index); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal int GetDepthIndex() { int ret = Interop.VisualBase.GetDepthIndex(SwigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal void CreatePropertyMap(PropertyMap map) { Interop.VisualBase.CreatePropertyMap(SwigCPtr, PropertyMap.getCPtr(map)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// This will not be public opened. [EditorBrowsable(EditorBrowsableState.Never)] protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) { Interop.VisualBase.DeleteVisualBase(swigCPtr); } } }