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