sync with devel/master branch
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / PropertyNotification.cs
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 3.0.9
6 //
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
10
11 namespace Tizen.NUI
12 {
13
14     using System;
15     using System.Runtime.InteropServices;
16
17
18     internal class PropertyNotification : BaseHandle
19     {
20         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
21
22         internal PropertyNotification(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PropertyNotification_SWIGUpcast(cPtr), cMemoryOwn)
23         {
24             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
25         }
26
27         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyNotification obj)
28         {
29             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
30         }
31
32         protected override void Dispose(DisposeTypes type)
33         {
34             if (disposed)
35             {
36                 return;
37             }
38
39             if (type == DisposeTypes.Explicit)
40             {
41                 //Called by User
42                 //Release your own managed resources here.
43                 //You should release all of your own disposable objects here.
44
45             }
46
47             //Release your own unmanaged resources here.
48             //You should not access any managed member here except static instance.
49             //because the execution order of Finalizes is non-deterministic.
50
51             if (swigCPtr.Handle != global::System.IntPtr.Zero)
52             {
53                 if (swigCMemOwn)
54                 {
55                     swigCMemOwn = false;
56                     NDalicPINVOKE.delete_PropertyNotification(swigCPtr);
57                 }
58                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
59             }
60
61             base.Dispose(type);
62         }
63
64         /**
65           * @brief Event arguments that passed via Notify signal
66           *
67           */
68         public class NotifyEventArgs : EventArgs
69         {
70             private PropertyNotification _propertyNotification;
71
72             /**
73               * @brief PropertyNotification - is the PropertyNotification handle that has the notification properties.
74               *
75               */
76             public PropertyNotification PropertyNotification
77             {
78                 get
79                 {
80                     return _propertyNotification;
81                 }
82                 set
83                 {
84                     _propertyNotification = value;
85                 }
86             }
87         }
88
89         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
90         private delegate void NotifyEventCallbackDelegate(IntPtr propertyNotification);
91         private DaliEventHandler<object, NotifyEventArgs> _propertyNotificationNotifyEventHandler;
92         private NotifyEventCallbackDelegate _propertyNotificationNotifyEventCallbackDelegate;
93
94         /**
95           * @brief Event for Notified signal which can be used to subscribe/unsubscribe the event handler
96           * (in the type of NotifyEventHandler-DaliEventHandler<object,NotifyEventArgs>) provided by the user.
97           * Notified signal is emitted when the notification upon a condition of the property being met, has occurred.
98           */
99         public event DaliEventHandler<object, NotifyEventArgs> Notified
100         {
101             add
102             {
103                 lock (this)
104                 {
105                     // Restricted to only one listener
106                     if (_propertyNotificationNotifyEventHandler == null)
107                     {
108                         _propertyNotificationNotifyEventHandler += value;
109
110                         _propertyNotificationNotifyEventCallbackDelegate = new NotifyEventCallbackDelegate(OnPropertyNotificationNotify);
111                         this.NotifySignal().Connect(_propertyNotificationNotifyEventCallbackDelegate);
112                     }
113                 }
114             }
115
116             remove
117             {
118                 lock (this)
119                 {
120                     if (_propertyNotificationNotifyEventHandler != null)
121                     {
122                         this.NotifySignal().Disconnect(_propertyNotificationNotifyEventCallbackDelegate);
123                     }
124
125                     _propertyNotificationNotifyEventHandler -= value;
126                 }
127             }
128         }
129
130         // Callback for PropertyNotification NotifySignal
131         private void OnPropertyNotificationNotify(IntPtr propertyNotification)
132         {
133             NotifyEventArgs e = new NotifyEventArgs();
134             e.PropertyNotification = GetPropertyNotificationFromPtr(propertyNotification);
135
136             if (_propertyNotificationNotifyEventHandler != null)
137             {
138                 //here we send all data to user event handlers
139                 _propertyNotificationNotifyEventHandler(this, e);
140             }
141         }
142
143         public static PropertyNotification GetPropertyNotificationFromPtr(global::System.IntPtr cPtr)
144         {
145             PropertyNotification ret = new PropertyNotification(cPtr, false);
146             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
147             return ret;
148         }
149
150
151         public PropertyNotification() : this(NDalicPINVOKE.new_PropertyNotification__SWIG_0(), true)
152         {
153             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154         }
155
156         public static PropertyNotification DownCast(BaseHandle handle)
157         {
158             PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.PropertyNotification_DownCast(BaseHandle.getCPtr(handle)), true);
159             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
160             return ret;
161         }
162
163         public PropertyNotification(PropertyNotification handle) : this(NDalicPINVOKE.new_PropertyNotification__SWIG_1(PropertyNotification.getCPtr(handle)), true)
164         {
165             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166         }
167
168         public PropertyNotification Assign(PropertyNotification rhs)
169         {
170             PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.PropertyNotification_Assign(swigCPtr, PropertyNotification.getCPtr(rhs)), false);
171             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
172             return ret;
173         }
174
175         public PropertyCondition GetCondition()
176         {
177             PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.PropertyNotification_GetCondition__SWIG_0(swigCPtr), true);
178             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179             return ret;
180         }
181
182         public Animatable GetTarget()
183         {
184             Animatable ret = new Animatable(NDalicPINVOKE.PropertyNotification_GetTarget(swigCPtr), true);
185             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
186             return ret;
187         }
188
189         public int GetTargetProperty()
190         {
191             int ret = NDalicPINVOKE.PropertyNotification_GetTargetProperty(swigCPtr);
192             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193             return ret;
194         }
195
196         public void SetNotifyMode(PropertyNotification.NotifyMode mode)
197         {
198             NDalicPINVOKE.PropertyNotification_SetNotifyMode(swigCPtr, (int)mode);
199             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
200         }
201
202         public PropertyNotification.NotifyMode GetNotifyMode()
203         {
204             PropertyNotification.NotifyMode ret = (PropertyNotification.NotifyMode)NDalicPINVOKE.PropertyNotification_GetNotifyMode(swigCPtr);
205             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
206             return ret;
207         }
208
209         public bool GetNotifyResult()
210         {
211             bool ret = NDalicPINVOKE.PropertyNotification_GetNotifyResult(swigCPtr);
212             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
213             return ret;
214         }
215
216         public PropertyNotifySignal NotifySignal()
217         {
218             PropertyNotifySignal ret = new PropertyNotifySignal(NDalicPINVOKE.PropertyNotification_NotifySignal(swigCPtr), false);
219             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
220             return ret;
221         }
222
223         public enum NotifyMode
224         {
225             Disabled,
226             NotifyOnTrue,
227             NotifyOnFalse,
228             NotifyOnChanged
229         }
230
231     }
232
233 }