Merge "Added support for animating the background color of a view." into devel/master
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / View.cs
index 35e4a64..6de4705 100755 (executable)
@@ -677,6 +677,50 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        // Resource Ready Signal
+
+        private EventHandler _resourcesLoadedEventHandler;
+        [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+        private delegate void ResourcesLoadedCallbackType(IntPtr control);
+        private ResourcesLoadedCallbackType _ResourcesLoadedCallback;
+
+        /// <summary>
+        /// Event for ResourcesLoadedSignal signal which can be used to subscribe/unsubscribe the event handler provided by the user.<br>
+        /// This signal is emitted after all resources required by a View are loaded and ready.<br>
+        /// </summary>
+        public event EventHandler ResourcesLoaded
+        {
+            add
+            {
+                if (_resourcesLoadedEventHandler == null)
+                {
+                    _ResourcesLoadedCallback = OnResourcesLoaded;
+                    this.ResourcesLoadedSignal().Connect(_ResourcesLoadedCallback);
+                }
+
+                _resourcesLoadedEventHandler += value;
+            }
+
+            remove
+            {
+                _resourcesLoadedEventHandler -= value;
+
+                if (_resourcesLoadedEventHandler == null && ResourcesLoadedSignal().Empty() == false)
+                {
+                    this.ResourcesLoadedSignal().Disconnect(_ResourcesLoadedCallback);
+                }
+            }
+        }
+
+        private void OnResourcesLoaded(IntPtr view)
+        {
+            if (_resourcesLoadedEventHandler != null)
+            {
+                _resourcesLoadedEventHandler(this, null);
+            }
+        }
+
+
         internal static View GetViewFromPtr(global::System.IntPtr cPtr)
         {
             View ret = new View(cPtr, false);
@@ -1901,6 +1945,18 @@ namespace Tizen.NUI.BaseComponents
         }
 
         /// <summary>
+        /// Query if all resources required by a View are loaded and ready.
+        /// </summary>
+        /// <remarks>Most resources are only loaded when the control is placed on stage
+        /// </remarks>
+        public bool IsResourceReady()
+        {
+            bool ret = NDalicPINVOKE.IsResourceReady(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
         /// Raise the view to above the target view.
         /// </summary>
         /// <remarks>Sibling order of views within the parent will be updated automatically.
@@ -2715,6 +2771,13 @@ namespace Tizen.NUI.BaseComponents
             return ret;
         }
 
+        internal ViewSignal ResourcesLoadedSignal()
+        {
+            ViewSignal ret = new ViewSignal(NDalicPINVOKE.ResourceReadySignal(swigCPtr), false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
         /// <summary>
         /// Gets/Sets the origin of an view, within its parent's area.<br>
         /// This is expressed in unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent, and(1.0, 1.0, 0.5) is the bottom-right corner.<br>