From 04215c02a440b4c58b11df9920d1e15dd8d6e475 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Tue, 4 Jul 2017 15:50:36 +0100 Subject: [PATCH] (Layer) Add Viewport properties Change-Id: I53a7ed6ebbbceebe2034c498b6dc29ee05688596 --- Tizen.NUI/src/public/Layer.cs | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/Tizen.NUI/src/public/Layer.cs b/Tizen.NUI/src/public/Layer.cs index 02d9adc..28e6247 100755 --- a/Tizen.NUI/src/public/Layer.cs +++ b/Tizen.NUI/src/public/Layer.cs @@ -332,6 +332,55 @@ namespace Tizen.NUI } /// + /// Internal only property to Enable/Disable Clipping, type Boolean. + /// By default this is false, i.e. the viewport of the Layer is the entire window. + /// + internal bool ClippingEnabled + { + get + { + bool ret = NDalicPINVOKE.Layer_IsClipping(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + set + { + NDalicPINVOKE.Layer_SetClipping(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + /// + /// Sets the Viewport (in window coordinates), type Rectangle. + /// The contents of the layer will not be visible outside this box, when ViewportEnabled is true. + /// + public Rectangle Viewport + { + get + { + if( ClippingEnabled ) + { + Rectangle ret = new Rectangle(NDalicPINVOKE.Layer_GetClippingBox(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + else + { + // Clipping not enabled so return the window size + Size2D windowSize = Window.Instance.Size; + Rectangle ret = new Rectangle(0, 0, windowSize.Width, windowSize.Height); + return ret; + } + } + set + { + NDalicPINVOKE.Layer_SetClippingBox__SWIG_1(swigCPtr, Rectangle.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + ClippingEnabled = true; + } + } + + /// /// Retrieves and sets the Layer's opacity.
///
public float Opacity -- 2.7.4