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 ACTOR_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName)
19 %typemap(csimports) NameSpace::ClassName %{
21 using System.Runtime.InteropServices;
26 %define ACTOR_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName)
27 %typemap(cscode) NameSpace::ClassName %{
31 * @brief Event arguments that passed via Touch signal
34 public class TouchEventArgs : EventArgs
37 private TouchData _touchData;
40 * @brief Actor - is the actor that is being touched
56 * @brief TouchData - contains the information of touch points
59 public TouchData TouchData
73 * @brief Event arguments that passed via Hover signal
76 public class HoverEventArgs : EventArgs
79 private HoverEvent _hoverEvent;
82 * @brief Actor - is the actor that is being hovered
98 * @brief HoverEvent - contains touch points that represent the points
99 * that are currently being hovered or the points where a hover has stopped
102 public HoverEvent HoverEvent
116 * @brief Event arguments that passed via Wheel signal
119 public class WheelEventArgs : EventArgs
121 private Actor _actor;
122 private WheelEvent _wheelEvent;
125 * @brief Actor - is the actor that is being wheeled
141 * @brief WheelEvent - store a wheel rolling type : MOUSE_WHEEL or CUSTOM_WHEEL
144 public WheelEvent WheelEvent
158 * @brief Event arguments that passed via OnStage signal
161 public class OnStageEventArgs : EventArgs
163 private Actor _actor;
166 * @brief Actor - is the actor that is being connected to the stage
183 * @brief Event arguments that passed via OffStage signal
186 public class OffStageEventArgs : EventArgs
188 private Actor _actor;
191 * @brief Actor - is the actor that is being disconnected from the stage
208 * @brief Event arguments that passed via OnRelayout signal
211 public class OnRelayoutEventArgs : EventArgs
213 private Actor _actor;
216 * @brief Actor - is the actor that is being resized upon relayout
233 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
234 private delegate bool TouchCallbackDelegate(IntPtr actor, IntPtr touchData);
235 private DaliEventHandlerWithReturnType<object,TouchEventArgs,bool> _actorTouchDataEventHandler;
236 private TouchCallbackDelegate _actorTouchDataCallbackDelegate;
238 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
239 private delegate bool HoverEventCallbackDelegate(IntPtr actor, IntPtr hoverEvent);
240 private DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> _actorHoverEventHandler;
241 private HoverEventCallbackDelegate _actorHoverEventCallbackDelegate;
243 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
244 private delegate bool WheelEventCallbackDelegate(IntPtr actor, IntPtr wheelEvent);
245 private DaliEventHandlerWithReturnType<object,WheelEventArgs,bool> _actorWheelEventHandler;
246 private WheelEventCallbackDelegate _actorWheelEventCallbackDelegate;
248 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
249 private delegate void OnStageEventCallbackDelegate(IntPtr actor);
250 private DaliEventHandler<object,OnStageEventArgs> _actorOnStageEventHandler;
251 private OnStageEventCallbackDelegate _actorOnStageEventCallbackDelegate;
253 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
254 private delegate void OffStageEventCallbackDelegate(IntPtr actor);
255 private DaliEventHandler<object,OffStageEventArgs> _actorOffStageEventHandler;
256 private OffStageEventCallbackDelegate _actorOffStageEventCallbackDelegate;
258 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
259 private delegate void OnRelayoutEventCallbackDelegate(IntPtr actor);
260 private DaliEventHandler<object,OnRelayoutEventArgs> _actorOnRelayoutEventHandler;
261 private OnRelayoutEventCallbackDelegate _actorOnRelayoutEventCallbackDelegate;
264 * @brief Event for Touched signal which can be used to subscribe/unsubscribe the event handler
265 * (in the type of TouchEventHandler-DaliEventHandlerWithReturnType<object,TouchEventArgs,bool>)
266 * provided by the user. Touched signal is emitted when touch input is received.
268 public event DaliEventHandlerWithReturnType<object,TouchEventArgs,bool> Touched
274 // Restricted to only one listener
275 if (_actorTouchDataEventHandler == null)
277 _actorTouchDataEventHandler += value;
279 _actorTouchDataCallbackDelegate = new TouchCallbackDelegate(OnTouch);
280 this.TouchSignal().Connect(_actorTouchDataCallbackDelegate);
289 if (_actorTouchDataEventHandler != null)
291 this.TouchSignal().Disconnect(_actorTouchDataCallbackDelegate);
294 _actorTouchDataEventHandler -= value;
299 // Callback for Actor TouchSignal
300 private bool OnTouch(IntPtr actor, IntPtr touchData)
302 TouchEventArgs e = new TouchEventArgs();
304 // Populate all members of "e" (TouchEventArgs) with real data
305 e.Actor = Actor.GetActorFromPtr(actor);
306 e.TouchData = Dali.TouchData.GetTouchDataFromPtr(touchData);
308 if (_actorTouchDataEventHandler != null)
310 //here we send all data to user event handlers
311 return _actorTouchDataEventHandler(this, e);
318 * @brief Event for Hovered signal which can be used to subscribe/unsubscribe the event handler
319 * (in the type of HoverEventHandler-DaliEventHandlerWithReturnType<object,HoverEventArgs,bool>)
320 * provided by the user. Hovered signal is emitted when hover input is received.
322 public event DaliEventHandlerWithReturnType<object,HoverEventArgs,bool> Hovered
328 // Restricted to only one listener
329 if (_actorHoverEventHandler == null)
331 _actorHoverEventHandler += value;
333 _actorHoverEventCallbackDelegate = new HoverEventCallbackDelegate(OnHoverEvent);
334 this.HoveredSignal().Connect(_actorHoverEventCallbackDelegate);
343 if (_actorHoverEventHandler != null)
345 this.HoveredSignal().Disconnect(_actorHoverEventCallbackDelegate);
348 _actorHoverEventHandler -= value;
353 // Callback for Actor Hover signal
354 private bool OnHoverEvent(IntPtr actor, IntPtr hoverEvent)
356 HoverEventArgs e = new HoverEventArgs();
358 // Populate all members of "e" (HoverEventArgs) with real data
359 e.Actor = Actor.GetActorFromPtr(actor);
360 e.HoverEvent = Dali.HoverEvent.GetHoverEventFromPtr(hoverEvent);
362 if (_actorHoverEventHandler != null)
364 //here we send all data to user event handlers
365 return _actorHoverEventHandler(this, e);
372 * @brief Event for WheelMoved signal which can be used to subscribe/unsubscribe the event handler
373 * (in the type of WheelEventHandler-DaliEventHandlerWithReturnType<object,WheelEventArgs,bool>)
374 * provided by the user. WheelMoved signal is emitted when wheel event is received.
376 public event DaliEventHandlerWithReturnType<object,WheelEventArgs,bool> WheelMoved
382 // Restricted to only one listener
383 if (_actorWheelEventHandler == null)
385 _actorWheelEventHandler += value;
387 _actorWheelEventCallbackDelegate = new WheelEventCallbackDelegate(OnWheelEvent);
388 this.WheelEventSignal().Connect(_actorWheelEventCallbackDelegate);
397 if (_actorWheelEventHandler != null)
399 this.WheelEventSignal().Disconnect(_actorWheelEventCallbackDelegate);
402 _actorWheelEventHandler -= value;
407 // Callback for Actor Wheel signal
408 private bool OnWheelEvent(IntPtr actor, IntPtr wheelEvent)
410 WheelEventArgs e = new WheelEventArgs();
412 // Populate all members of "e" (WheelEventArgs) with real data
413 e.Actor = Actor.GetActorFromPtr(actor);
414 e.WheelEvent = Dali.WheelEvent.GetWheelEventFromPtr(wheelEvent);
416 if (_actorWheelEventHandler != null)
418 //here we send all data to user event handlers
419 return _actorWheelEventHandler(this, e);
426 * @brief Event for OnStage signal which can be used to subscribe/unsubscribe the event handler
427 * (in the type of OnStageEventHandler) provided by the user.
428 * OnStage signal is emitted after the actor has been connected to the stage.
430 public event DaliEventHandler<object,OnStageEventArgs> OnStageEvent
436 // Restricted to only one listener
437 if (_actorOnStageEventHandler == null)
439 _actorOnStageEventHandler += value;
441 _actorOnStageEventCallbackDelegate = new OnStageEventCallbackDelegate(OnStage);
442 this.OnStageSignal().Connect(_actorOnStageEventCallbackDelegate);
451 if (_actorOnStageEventHandler != null)
453 this.OnStageSignal().Disconnect(_actorOnStageEventCallbackDelegate);
456 _actorOnStageEventHandler -= value;
461 // Callback for Actor OnStage signal
462 private void OnStage(IntPtr data)
464 OnStageEventArgs e = new OnStageEventArgs();
466 // Populate all members of "e" (OnStageEventArgs) with real data
467 e.Actor = Actor.GetActorFromPtr(data);
469 if (_actorOnStageEventHandler != null)
471 //here we send all data to user event handlers
472 _actorOnStageEventHandler(this, e);
477 * @brief Event for OffStage signal which can be used to subscribe/unsubscribe the event handler
478 * (in the type of OffStageEventHandler) provided by the user.
479 * OffStage signal is emitted after the actor has been disconnected from the stage.
481 public event DaliEventHandler<object,OffStageEventArgs> OffStageEvent
487 // Restricted to only one listener
488 if (_actorOffStageEventHandler == null)
490 _actorOffStageEventHandler += value;
492 _actorOffStageEventCallbackDelegate = new OffStageEventCallbackDelegate(OffStage);
493 this.OnStageSignal().Connect(_actorOffStageEventCallbackDelegate);
502 if (_actorOffStageEventHandler != null)
504 this.OnStageSignal().Disconnect(_actorOffStageEventCallbackDelegate);
507 _actorOffStageEventHandler -= value;
512 // Callback for Actor OffStage signal
513 private void OffStage(IntPtr data)
515 OffStageEventArgs e = new OffStageEventArgs();
517 // Populate all members of "e" (OffStageEventArgs) with real data
518 e.Actor = Actor.GetActorFromPtr(data);
520 if (_actorOffStageEventHandler != null)
522 //here we send all data to user event handlers
523 _actorOffStageEventHandler(this, e);
528 * @brief Event for OnRelayout signal which can be used to subscribe/unsubscribe the event handler
529 * (in the type of OnRelayoutEventHandler) provided by the user.
530 * OnRelayout signal is emitted after the size has been set on the actor during relayout.
532 public event DaliEventHandler<object,OnRelayoutEventArgs> OnRelayoutEvent
538 // Restricted to only one listener
539 if (_actorOnRelayoutEventHandler == null)
541 _actorOnRelayoutEventHandler += value;
543 _actorOnRelayoutEventCallbackDelegate = new OnRelayoutEventCallbackDelegate(OnRelayout);
544 this.OnRelayoutSignal().Connect(_actorOnRelayoutEventCallbackDelegate);
553 if (_actorOnRelayoutEventHandler != null)
555 this.OnRelayoutSignal().Disconnect(_actorOnRelayoutEventCallbackDelegate);
558 _actorOnRelayoutEventHandler -= value;
563 // Callback for Actor OnRelayout signal
564 private void OnRelayout(IntPtr data)
566 OnRelayoutEventArgs e = new OnRelayoutEventArgs();
568 // Populate all members of "e" (OnRelayoutEventArgs) with real data
569 e.Actor = Actor.GetActorFromPtr(data);
571 if (_actorOnRelayoutEventHandler != null)
573 //here we send all data to user event handlers
574 _actorOnRelayoutEventHandler(this, e);
578 public static ClassName Get ## ClassName ## FromPtr(global::System.IntPtr cPtr) {
579 ClassName ret = new ClassName(cPtr, false);
580 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
584 public IntPtr GetPtrfrom ## ClassName ()
586 return (IntPtr)swigCPtr;
593 Actor parent = GetParent();
602 bool visibility = IsVisible();
615 public float CurrentOpacity
619 float ret = GetCurrentOpacity();
624 public bool StateFocusEnable
628 SetKeyboardFocusable(value);
632 bool focusable = IsKeyboardFocusable();
651 %define DALI_ACTOR_EVENTHANDLER_PARAM( NameSpace, ClassName)
653 ACTOR_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName);
654 ACTOR_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName);
660 DALI_ACTOR_EVENTHANDLER_PARAM( Dali, Actor);