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 ITEMVIEW_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
27 %define ITEMVIEW_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
28 %typemap(cscode) NameSpace::ClassName %{
30 public class LayoutActivatedEventArgs : EventArgs
34 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
35 public delegate void LayoutActivatedEventHandler(object source, LayoutActivatedEventArgs e);
37 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
38 private delegate void LayoutActivatedEventCallbackDelegate();
39 private LayoutActivatedEventHandler _itemViewLayoutActivatedEventHandler;
40 private LayoutActivatedEventCallbackDelegate _itemViewLayoutActivatedEventCallbackDelegate;
42 public event LayoutActivatedEventHandler LayoutActivated
48 // Restricted to only one listener
49 if (_itemViewLayoutActivatedEventHandler == null)
51 _itemViewLayoutActivatedEventHandler += value;
53 _itemViewLayoutActivatedEventCallbackDelegate = new LayoutActivatedEventCallbackDelegate(OnLayoutActivated);
54 this.LayoutActivatedSignal().Connect(_itemViewLayoutActivatedEventCallbackDelegate);
63 if (_itemViewLayoutActivatedEventHandler != null)
65 this.LayoutActivatedSignal().Disconnect(_itemViewLayoutActivatedEventCallbackDelegate);
68 _itemViewLayoutActivatedEventHandler -= value;
73 // Callback for ItemView LayoutActivatedSignal
74 private void OnLayoutActivated()
76 LayoutActivatedEventArgs e = new LayoutActivatedEventArgs();
78 if (_itemViewLayoutActivatedEventHandler != null)
80 //here we send all data to user event handlers
81 _itemViewLayoutActivatedEventHandler(this, e);
88 %define DALI_ITEMVIEW_EVENTHANDLER_PARAM( NameSpace, ClassName)
89 ITEMVIEW_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
90 ITEMVIEW_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
95 DALI_ITEMVIEW_EVENTHANDLER_PARAM( Dali::Toolkit, ItemView);