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 private delegate void LayoutActivatedEventCallbackDelegate();
36 private DaliEventHandler<object,LayoutActivatedEventArgs> _itemViewLayoutActivatedEventHandler;
37 private LayoutActivatedEventCallbackDelegate _itemViewLayoutActivatedEventCallbackDelegate;
39 public event DaliEventHandler<object,LayoutActivatedEventArgs> LayoutActivated
45 // Restricted to only one listener
46 if (_itemViewLayoutActivatedEventHandler == null)
48 _itemViewLayoutActivatedEventHandler += value;
50 _itemViewLayoutActivatedEventCallbackDelegate = new LayoutActivatedEventCallbackDelegate(OnLayoutActivated);
51 this.LayoutActivatedSignal().Connect(_itemViewLayoutActivatedEventCallbackDelegate);
60 if (_itemViewLayoutActivatedEventHandler != null)
62 this.LayoutActivatedSignal().Disconnect(_itemViewLayoutActivatedEventCallbackDelegate);
65 _itemViewLayoutActivatedEventHandler -= value;
70 // Callback for ItemView LayoutActivatedSignal
71 private void OnLayoutActivated()
73 LayoutActivatedEventArgs e = new LayoutActivatedEventArgs();
75 if (_itemViewLayoutActivatedEventHandler != null)
77 //here we send all data to user event handlers
78 _itemViewLayoutActivatedEventHandler(this, e);
85 %define DALI_ITEMVIEW_EVENTHANDLER_PARAM( NameSpace, ClassName)
86 ITEMVIEW_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
87 ITEMVIEW_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
92 DALI_ITEMVIEW_EVENTHANDLER_PARAM( Dali::Toolkit, ItemView);