Merge "Updated tests using Integration KeyEvent" into devel/master
[platform/core/uifw/dali-toolkit.git] / plugins / dali-sharp / sharp / internal / PropertyNotification.cs
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 3.0.10
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 Dali {
12
13 using System;
14 using System.Runtime.InteropServices;
15
16
17 public class PropertyNotification : BaseHandle {
18   private global::System.Runtime.InteropServices.HandleRef swigCPtr;
19
20   internal PropertyNotification(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PropertyNotification_SWIGUpcast(cPtr), cMemoryOwn) {
21     swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
22   }
23
24   internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyNotification obj) {
25     return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
26   }
27
28   ~PropertyNotification() {
29     DisposeQueue.Instance.Add(this);
30   }
31
32   public override void Dispose() {
33     if (!Stage.IsInstalled()) {
34       DisposeQueue.Instance.Add(this);
35       return;
36     }
37
38     lock(this) {
39       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
40         if (swigCMemOwn) {
41           swigCMemOwn = false;
42           NDalicPINVOKE.delete_PropertyNotification(swigCPtr);
43         }
44         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
45       }
46       global::System.GC.SuppressFinalize(this);
47       base.Dispose();
48     }
49   }
50
51
52
53 /**
54   * @brief Event arguments that passed via Notify signal
55   *
56   */
57 public class NotifyEventArgs : EventArgs
58 {
59    private PropertyNotification _propertyNotification;
60
61    /**
62      * @brief PropertyNotification - is the PropertyNotification handle that has the notification properties.
63      *
64      */
65    public PropertyNotification PropertyNotification
66    {
67       get
68       {
69          return _propertyNotification;
70       }
71       set
72       {
73          _propertyNotification = value;
74       }
75    }
76 }
77
78   [UnmanagedFunctionPointer(CallingConvention.StdCall)]
79   private delegate void NotifyEventCallbackDelegate(IntPtr propertyNotification);
80   private DaliEventHandler<object,NotifyEventArgs> _propertyNotificationNotifyEventHandler;
81   private NotifyEventCallbackDelegate _propertyNotificationNotifyEventCallbackDelegate;
82
83   /**
84     * @brief Event for Notified signal which can be used to subscribe/unsubscribe the event handler
85     * (in the type of NotifyEventHandler-DaliEventHandler<object,NotifyEventArgs>) provided by the user.
86     * Notified signal is emitted when the notification upon a condition of the property being met, has occurred.
87     */
88   public event DaliEventHandler<object,NotifyEventArgs> Notified
89   {
90      add
91      {
92         lock(this)
93         {
94            // Restricted to only one listener
95            if (_propertyNotificationNotifyEventHandler == null)
96            {
97               _propertyNotificationNotifyEventHandler += value;
98
99               _propertyNotificationNotifyEventCallbackDelegate = new NotifyEventCallbackDelegate(OnPropertyNotificationNotify);
100               this.NotifySignal().Connect(_propertyNotificationNotifyEventCallbackDelegate);
101            }
102         }
103      }
104
105      remove
106      {
107         lock(this)
108         {
109            if (_propertyNotificationNotifyEventHandler != null)
110            {
111               this.NotifySignal().Disconnect(_propertyNotificationNotifyEventCallbackDelegate);
112            }
113
114            _propertyNotificationNotifyEventHandler -= value;
115         }
116      }
117   }
118
119   // Callback for PropertyNotification NotifySignal
120   private void OnPropertyNotificationNotify(IntPtr propertyNotification)
121   {
122      NotifyEventArgs e = new NotifyEventArgs();
123      e.PropertyNotification  = GetPropertyNotificationFromPtr(propertyNotification);
124
125      if (_propertyNotificationNotifyEventHandler != null)
126      {
127         //here we send all data to user event handlers
128         _propertyNotificationNotifyEventHandler(this, e);
129      }
130   }
131
132   public static PropertyNotification GetPropertyNotificationFromPtr(global::System.IntPtr cPtr) {
133     PropertyNotification ret = new PropertyNotification(cPtr, false);
134    if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135     return ret;
136   }
137
138
139   public PropertyNotification() : this(NDalicPINVOKE.new_PropertyNotification__SWIG_0(), true) {
140     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141   }
142
143   public static PropertyNotification DownCast(BaseHandle handle) {
144     PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.PropertyNotification_DownCast(BaseHandle.getCPtr(handle)), true);
145     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
146     return ret;
147   }
148
149   public PropertyNotification(PropertyNotification handle) : this(NDalicPINVOKE.new_PropertyNotification__SWIG_1(PropertyNotification.getCPtr(handle)), true) {
150     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151   }
152
153   public PropertyNotification Assign(PropertyNotification rhs) {
154     PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.PropertyNotification_Assign(swigCPtr, PropertyNotification.getCPtr(rhs)), false);
155     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156     return ret;
157   }
158
159   public PropertyCondition GetCondition() {
160     PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.PropertyNotification_GetCondition__SWIG_0(swigCPtr), true);
161     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
162     return ret;
163   }
164
165   public Handle GetTarget() {
166     Handle ret = new Handle(NDalicPINVOKE.PropertyNotification_GetTarget(swigCPtr), true);
167     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168     return ret;
169   }
170
171   public int GetTargetProperty() {
172     int ret = NDalicPINVOKE.PropertyNotification_GetTargetProperty(swigCPtr);
173     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
174     return ret;
175   }
176
177   public void SetNotifyMode(PropertyNotification.NotifyMode mode) {
178     NDalicPINVOKE.PropertyNotification_SetNotifyMode(swigCPtr, (int)mode);
179     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180   }
181
182   public PropertyNotification.NotifyMode GetNotifyMode() {
183     PropertyNotification.NotifyMode ret = (PropertyNotification.NotifyMode)NDalicPINVOKE.PropertyNotification_GetNotifyMode(swigCPtr);
184     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
185     return ret;
186   }
187
188   public bool GetNotifyResult() {
189     bool ret = NDalicPINVOKE.PropertyNotification_GetNotifyResult(swigCPtr);
190     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
191     return ret;
192   }
193
194   public PropertyNotifySignal NotifySignal() {
195     PropertyNotifySignal ret = new PropertyNotifySignal(NDalicPINVOKE.PropertyNotification_NotifySignal(swigCPtr), false);
196     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
197     return ret;
198   }
199
200   public enum NotifyMode {
201     Disabled,
202     NotifyOnTrue,
203     NotifyOnFalse,
204     NotifyOnChanged
205   }
206
207 }
208
209 }