2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 %define PROPERTYNOTIFICATION_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
28 %define PROPERTYNOTIFICATION_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
29 %typemap(cscode) NameSpace::ClassName %{
32 * @brief Event arguments that passed via Notify signal
35 public class NotifyEventArgs : EventArgs
37 private PropertyNotification _propertyNotification;
40 * @brief PropertyNotification - is the PropertyNotification handle that has the notification properties.
43 public PropertyNotification PropertyNotification
47 return _propertyNotification;
51 _propertyNotification = value;
56 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
57 private delegate void NotifyEventCallbackDelegate(IntPtr propertyNotification);
58 private DaliEventHandler<object,NotifyEventArgs> _propertyNotificationNotifyEventHandler;
59 private NotifyEventCallbackDelegate _propertyNotificationNotifyEventCallbackDelegate;
62 * @brief Event for Notified signal which can be used to subscribe/unsubscribe the event handler
63 * (in the type of NotifyEventHandler-DaliEventHandler<object,NotifyEventArgs>) provided by the user.
64 * Notified signal is emitted when the notification upon a condition of the property being met, has occurred.
66 public event DaliEventHandler<object,NotifyEventArgs> Notified
72 // Restricted to only one listener
73 if (_propertyNotificationNotifyEventHandler == null)
75 _propertyNotificationNotifyEventHandler += value;
77 _propertyNotificationNotifyEventCallbackDelegate = new NotifyEventCallbackDelegate(OnPropertyNotificationNotify);
78 this.NotifySignal().Connect(_propertyNotificationNotifyEventCallbackDelegate);
87 if (_propertyNotificationNotifyEventHandler != null)
89 this.NotifySignal().Disconnect(_propertyNotificationNotifyEventCallbackDelegate);
92 _propertyNotificationNotifyEventHandler -= value;
97 // Callback for PropertyNotification NotifySignal
98 private void OnPropertyNotificationNotify(IntPtr propertyNotification)
100 NotifyEventArgs e = new NotifyEventArgs();
101 e.PropertyNotification = GetPropertyNotificationFromPtr(propertyNotification);
103 if (_propertyNotificationNotifyEventHandler != null)
105 //here we send all data to user event handlers
106 _propertyNotificationNotifyEventHandler(this, e);
110 public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
111 ClassName ret = new ClassName(cPtr, false);
112 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119 %define DALI_PROPERTYNOTIFICATION_EVENTHANDLER_PARAM( NameSpace, ClassName)
120 PROPERTYNOTIFICATION_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
121 PROPERTYNOTIFICATION_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
126 DALI_PROPERTYNOTIFICATION_EVENTHANDLER_PARAM( Dali, PropertyNotification);