Setting since_tizen 3/4 on Tizen.NET API
[platform/core/csapi/tizenfx.git] / src / Tizen.Applications.AttachPanel / Tizen.Applications.AttachPanel / AttachPanel.cs
index bd403f0..c718489 100755 (executable)
@@ -1,3 +1,4 @@
+using ElmSharp;
 using System;
 
 namespace Tizen.Applications.AttachPanel
@@ -10,19 +11,20 @@ namespace Tizen.Applications.AttachPanel
         /// <summary>
         /// Represents immutable class for attach panel.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 4 </since_tizen>
         /// <param name="conformant">The caller's conformant</param>
         /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
         /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is already exist or the <paramref name="conformant"/> is not a conformant object</exception>
-        public AttachPanel(IntPtr conformant)
+        public AttachPanel(EvasObject conformant)
         {
             if (conformant == IntPtr.Zero)
             {
                 throw new ArgumentNullException("Use the value property, not null value");
             }
+
             IntPtr candidateAttachPanel = new IntPtr();
             Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.CreateAttachPanel(conformant, ref candidateAttachPanel);
-            checkException(err);
+            CheckException(err);
 
             Tizen.Log.Debug("AttachPanelSharp", "Success to create an AttachPanel Instance");
             isCreationSucceed = true;
@@ -39,13 +41,49 @@ namespace Tizen.Applications.AttachPanel
             }
         }
 
+        /// <summary>
+        /// Represents immutable class for attach panel.
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        /// <param name="conformant">The caller's conformant</param>
+        /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
+        /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is already exist or the <paramref name="conformant"/> is not a conformant object</exception>
+        public AttachPanel(Conformant conformant)
+        {
+            if (conformant == IntPtr.Zero)
+            {
+                throw new ArgumentNullException("Use the value property, not null value");
+            }
+
+            IntPtr candidateAttachPanel = new IntPtr();
+            Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.CreateAttachPanel(conformant, ref candidateAttachPanel);
+            CheckException(err);
+
+            Tizen.Log.Debug("AttachPanelSharp", "Success to create an AttachPanel Instance");
+            isCreationSucceed = true;
+            _attachPanel = candidateAttachPanel;
+
+            if (_eventEventHandler == null)
+            {
+                StateEventListenStart();
+            }
+
+            if (_resultEventHandler == null)
+            {
+                ResultEventListenStart();
+            }
+        }
+
+        /// <summary>
+        /// A destructor which deallocates attach panel resources.
+        /// </summary>
         ~AttachPanel()
         {
             if (isCreationSucceed &&
                 _attachPanel != IntPtr.Zero)
             {
                 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.DestroyAttachPanel(_attachPanel);
-                checkException(err);
+                CheckException(err);
                 _attachPanel = IntPtr.Zero;
             }
         }
@@ -54,13 +92,15 @@ namespace Tizen.Applications.AttachPanel
         /// Gets the state of the AttachPanel.
         /// </summary>
         /// <value>The AttachPanel window state</value>
-        public int State
+        /// <since_tizen> 4 </since_tizen>
+        public StateType State
         {
             get
             {
-                int state;
-                Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetState(_attachPanel, out state);
-                checkException(err);
+                int interopState;
+                Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetState(_attachPanel, out interopState);
+                CheckException(err);
+                StateType state = (StateType)Enum.ToObject(typeof(StateType), interopState);
                 return state;
             }
         }
@@ -69,14 +109,15 @@ namespace Tizen.Applications.AttachPanel
         /// Gets the value that indicates whether the AttachPanel is visible.
         /// </summary>
         /// <value>visible value of AttachPanel state</value>
-        public int Visible
+        /// <since_tizen> 4 </since_tizen>
+        public bool Visible
         {
             get
             {
                 int visible;
                 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetVisibility(_attachPanel, out visible);
-                checkException(err);
-                return visible;
+                CheckException(err);
+                return (visible == 1);
             }
         }
 
@@ -111,6 +152,7 @@ namespace Tizen.Applications.AttachPanel
         /// <exception cref="UnauthorizedAccessException">Thrown when application does not have privilege to access this method</exception>
         /// <exception cref="NotSupportedException">Thrown when the device does not supported the <paramref name="category"/> feature </exception>
         /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
+        /// <since_tizen> 4 </since_tizen>
         public void AddCategory(ContentCategory category, Bundle extraData)
         {
             IntPtr bundle = IntPtr.Zero;
@@ -118,8 +160,9 @@ namespace Tizen.Applications.AttachPanel
             {
                 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
             }
+
             Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.AddCategory(_attachPanel, (int)category, bundle);
-            checkException(err);
+            CheckException(err);
         }
 
         /// <summary>
@@ -128,10 +171,11 @@ namespace Tizen.Applications.AttachPanel
         /// <param name="category">The ContentCategory adding in the AttachPanel</param>
         ///  <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
         /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is not created yet or already destroyed</exception>
+        /// <since_tizen> 4 </since_tizen>
         public void RemoveCategory(ContentCategory category)
         {
             Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.RemoveCategory(_attachPanel, (int)category);
-            checkException(err);
+            CheckException(err);
         }
 
         /// <summary>
@@ -142,11 +186,12 @@ namespace Tizen.Applications.AttachPanel
         /// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="category"/> is not a valid category</exception>
         /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
         /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate memory fails.</exception>
+        /// <since_tizen> 4 </since_tizen>
         public void SetExtraData(ContentCategory category, Bundle extraData)
         {
-            if(extraData == null)
+            if (extraData == null)
             {
-                checkException(Interop.AttachPanel.ErrorCode.InvalidParameter);
+                CheckException(Interop.AttachPanel.ErrorCode.InvalidParameter);
             }
 
             IntPtr bundle = IntPtr.Zero;
@@ -154,35 +199,39 @@ namespace Tizen.Applications.AttachPanel
             {
                 bundle = extraData.SafeBundleHandle.DangerousGetHandle();
             }
+
             Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.SetExtraData(_attachPanel, (int)category, bundle);
-            checkException(err);
+            CheckException(err);
         }
 
         /// <summary>
         /// Shows the attach panel with animations
         /// </summary>
         /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
+        /// <since_tizen> 4 </since_tizen>
         public void Show()
         {
             Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
-            checkException(err);
+            CheckException(err);
         }
 
         /// <summary>
         /// Shows the attach panel and selects whether or not to animate
         /// </summary>
+        /// <param name="animation">A flag which turn on or turn off the animation while attach panel showing.</param>
         /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
+        /// <since_tizen> 4 </since_tizen>
         public void Show(bool animation)
         {
             if (animation)
             {
                 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel);
-                checkException(err);
+                CheckException(err);
             }
             else
             {
                 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.ShowWithoutAnimation(_attachPanel);
-                checkException(err);
+                CheckException(err);
             }
         }
 
@@ -190,33 +239,37 @@ namespace Tizen.Applications.AttachPanel
         /// Hides the attach panel with animations
         /// </summary>
         /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
+        /// <since_tizen> 4 </since_tizen>
         public void Hide()
         {
             Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
-            checkException(err);
+            CheckException(err);
         }
 
         /// <summary>
         /// Hides the attach panel and selects whether or not to animate
         /// </summary>
+        /// <param name="animation">A flag which turn on or turn off the animation while attach panel hiding.</param>
         /// <exception cref="InvalidOperationException">Thrown when the AttachPanel is destroyed</exception>
+        /// <since_tizen> 4 </since_tizen>
         public void Hide(bool animation)
         {
             if (animation)
             {
                 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel);
-                checkException(err);
+                CheckException(err);
             }
             else
             {
                 Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.HideWithoutAnimation(_attachPanel);
-                checkException(err);
+                CheckException(err);
             }
         }
 
         /// <summary>
         /// Occurs when reserved events are published from the panel-side.
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         public event EventHandler<StateEventArgs> EventChanged
         {
             add
@@ -225,8 +278,10 @@ namespace Tizen.Applications.AttachPanel
                 {
                     StateEventListenStart();
                 }
+
                 _eventEventHandler += value;
             }
+
             remove
             {
                 _eventEventHandler -= value;
@@ -240,6 +295,7 @@ namespace Tizen.Applications.AttachPanel
         /// <summary>
         /// Occurs when an user selects and confirms something to attach in the AttachPanel
         /// </summary>
+        /// <since_tizen> 4 </since_tizen>
         public event EventHandler<ResultEventArgs> ResultCallback
         {
             add
@@ -248,8 +304,10 @@ namespace Tizen.Applications.AttachPanel
                 {
                     ResultEventListenStart();
                 }
+
                 _resultEventHandler += value;
             }
+
             remove
             {
                 _resultEventHandler -= value;