(Layer) Add Viewport properties
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 4 Jul 2017 14:50:36 +0000 (15:50 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 5 Jul 2017 15:13:41 +0000 (16:13 +0100)
Change-Id: I53a7ed6ebbbceebe2034c498b6dc29ee05688596

src/Tizen.NUI/src/public/Layer.cs

index 02d9adc..28e6247 100755 (executable)
@@ -332,6 +332,55 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// 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.
+        /// </summary>
+        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();
+            }
+        }
+
+        /// <summary>
+        /// Sets the Viewport (in window coordinates), type Rectangle.
+        /// The contents of the layer will not be visible outside this box, when ViewportEnabled is true.
+        /// </summary>
+        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;
+            }
+        }
+
+        /// <summary>
         /// Retrieves and sets the Layer's opacity.<br>
         /// </summary>
         public float Opacity