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);
82 /* Properties earlier added by Ruby Script */
84 public float MinimumSwipeSpeed
89 GetProperty( ItemView.Property.MINIMUM_SWIPE_SPEED).Get( ref temp );
94 SetProperty( ItemView.Property.MINIMUM_SWIPE_SPEED, new Dali.Property.Value( value ) );
97 public float MinimumSwipeDistance
102 GetProperty( ItemView.Property.MINIMUM_SWIPE_DISTANCE).Get( ref temp );
107 SetProperty( ItemView.Property.MINIMUM_SWIPE_DISTANCE, new Dali.Property.Value( value ) );
110 public float WheelScrollDistanceStep
115 GetProperty( ItemView.Property.WHEEL_SCROLL_DISTANCE_STEP).Get( ref temp );
120 SetProperty( ItemView.Property.WHEEL_SCROLL_DISTANCE_STEP, new Dali.Property.Value( value ) );
123 public bool SnapToItemEnabled
128 GetProperty( ItemView.Property.SNAP_TO_ITEM_ENABLED).Get( ref temp );
133 SetProperty( ItemView.Property.SNAP_TO_ITEM_ENABLED, new Dali.Property.Value( value ) );
136 public float RefreshInterval
141 GetProperty( ItemView.Property.REFRESH_INTERVAL).Get( ref temp );
146 SetProperty( ItemView.Property.REFRESH_INTERVAL, new Dali.Property.Value( value ) );
149 public float LayoutPosition
154 GetProperty( ItemView.Property.LAYOUT_POSITION).Get( ref temp );
159 SetProperty( ItemView.Property.LAYOUT_POSITION, new Dali.Property.Value( value ) );
162 public float ScrollSpeed
167 GetProperty( ItemView.Property.SCROLL_SPEED).Get( ref temp );
172 SetProperty( ItemView.Property.SCROLL_SPEED, new Dali.Property.Value( value ) );
175 public float Overshoot
180 GetProperty( ItemView.Property.OVERSHOOT).Get( ref temp );
185 SetProperty( ItemView.Property.OVERSHOOT, new Dali.Property.Value( value ) );
188 public Dali.CSharp.Size ScrollDirection
192 Vector2 temp = new Vector2(0.0f,0.0f);
193 GetProperty( ItemView.Property.SCROLL_DIRECTION).Get( temp );
194 Dali.CSharp.Size ret = new Dali.CSharp.Size(temp.x, temp.y);
199 SetProperty( ItemView.Property.SCROLL_DIRECTION, new Dali.Property.Value( value ) );
202 public int LayoutOrientation
207 GetProperty( ItemView.Property.LAYOUT_ORIENTATION).Get( ref temp );
212 SetProperty( ItemView.Property.LAYOUT_ORIENTATION, new Dali.Property.Value( value ) );
215 public float ScrollContentSize
220 GetProperty( ItemView.Property.SCROLL_CONTENT_SIZE).Get( ref temp );
225 SetProperty( ItemView.Property.SCROLL_CONTENT_SIZE, new Dali.Property.Value( value ) );
229 /* Properties ends */
234 %define DALI_ITEMVIEW_EVENTHANDLER_PARAM( NameSpace, ClassName)
235 ITEMVIEW_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
236 ITEMVIEW_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
241 DALI_ITEMVIEW_EVENTHANDLER_PARAM( Dali::Toolkit, ItemView);