X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=plugins%2Fdali-swig%2FSWIG%2Fevents%2Fcontrol-event.i;h=489af5aa7951a5d9803ae1b10edc8e2546f46e70;hp=83eb9c4aa55084d500def25b120e19343bfd5553;hb=335cf329be8baef35ffb511926258ccd9bd72285;hpb=0b656e1b343a93e2c9a92f50e84e3b30575a494d diff --git a/plugins/dali-swig/SWIG/events/control-event.i b/plugins/dali-swig/SWIG/events/control-event.i index 83eb9c4..489af5a 100644 --- a/plugins/dali-swig/SWIG/events/control-event.i +++ b/plugins/dali-swig/SWIG/events/control-event.i @@ -16,297 +16,845 @@ */ %define CONTROL_EVENTHANDLER_TYPEMAP_EVENTARG(NameSpace, ClassName) -%typemap(csimports) NameSpace::ClassName %{ -using System; -using System.Runtime.InteropServices; + %typemap(csimports) NameSpace::ClassName %{ + using System; + using System.Runtime.InteropServices; -%} + %} -%enddef + %enddef %define CONTROL_EVENTHANDLER_TYPEMAP_HELPER(NameSpace, ClassName) -%typemap(cscode) NameSpace::ClassName %{ + %typemap(cscode) NameSpace::ClassName %{ -/** - * @brief Event arguments that passed via KeyInputFocusGained signal - * - */ -public class KeyInputFocusGainedEventArgs : EventArgs -{ - private View _view; - - /** - * @brief View - is the view that gets Key Input Focus + /** + * @brief Event arguments that passed via KeyInputFocusGained signal * */ - public View View - { - get + public class KeyInputFocusGainedEventArgs : EventArgs + { + private View _view; + + /** + * @brief View - is the view that gets Key Input Focus + * + */ + public View View { - return _view; + get + { + return _view; + } + set + { + _view = value; + } } - set + } + + /** + * @brief Event arguments that passed via KeyInputFocusLost signal + * + */ + public class KeyInputFocusLostEventArgs : EventArgs + { + private View _view; + + /** + * @brief View - is the view that loses Key Input Focus + * + */ + public View View { - _view = value; + get + { + return _view; + } + set + { + _view = value; + } } - } -} - -/** - * @brief Event arguments that passed via KeyInputFocusLost signal - * - */ -public class KeyInputFocusLostEventArgs : EventArgs -{ - private View _view; + } - /** - * @brief View - is the view that loses Key Input Focus + /** + * @brief Event arguments that passed via KeyEvent signal * */ - public View View - { - get + public class KeyEventArgs : EventArgs + { + private View _view; + private KeyEvent _keyEvent; + + /** + * @brief View - is the view that recieves the keyevent. + * + */ + public View View { - return _view; + get + { + return _view; + } + set + { + _view = value; + } } - set + + /** + * @brief KeyEvent - is the keyevent sent to the View. + * + */ + public KeyEvent KeyEvent { - _view = value; + get + { + return _keyEvent; + } + set + { + _keyEvent = value; + } + } + } + + /** + * @brief Event arguments that passed via OnRelayout signal + * + */ + public class OnRelayoutEventArgs : EventArgs + { + private View _view; + + /** + * @brief View - is the view that is being resized upon relayout + * + */ + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } + } + + + /** + * @brief Event arguments that passed via Touch signal + * + */ + public class TouchEventArgs : EventArgs + { + private View _view; + private TouchData _touchData; + + /** + * @brief View - is the view that is being touched + * + */ + public View View + { + get + { + return _view; + } + set + { + _view = value; + } } - } -} -/** - * @brief Event arguments that passed via KeyEvent signal - * - */ -public class KeyEventArgs : EventArgs -{ - private View _view; - private KeyEvent _keyEvent; + /** + * @brief TouchData - contains the information of touch points + * + */ + public TouchData TouchData + { + get + { + return _touchData; + } + set + { + _touchData = value; + } + } + } + + /** + * @brief Event arguments that passed via Hover signal + * + */ + public class HoverEventArgs : EventArgs + { + private View _view; + private HoverEvent _hoverEvent; + + /** + * @brief View - is the view that is being hovered + * + */ + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } - /** - * @brief View - is the view that recieves the keyevent. - * + /** + * @brief HoverEvent - contains touch points that represent the points + * that are currently being hovered or the points where a hover has stopped + * + */ + public HoverEvent HoverEvent + { + get + { + return _hoverEvent; + } + set + { + _hoverEvent = value; + } + } + } + + /** + * @brief Event arguments that passed via Wheel signal + * + */ + public class WheelEventArgs : EventArgs + { + private View _view; + private WheelEvent _wheelEvent; + + /** + * @brief View - is the view that is being wheeled + * + */ + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } + + /** + * @brief WheelEvent - store a wheel rolling type : MOUSE_WHEEL or CUSTOM_WHEEL + * + */ + public WheelEvent WheelEvent + { + get + { + return _wheelEvent; + } + set + { + _wheelEvent = value; + } + } + } + + /** + * @brief Event arguments that passed via OnStage signal + * + */ + public class OnStageEventArgs : EventArgs + { + private View _view; + + /** + * @brief View - is the view that is being connected to the stage + * + */ + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } + } + + /** + * @brief Event arguments that passed via OffStage signal + * + */ + public class OffStageEventArgs : EventArgs + { + private View _view; + + /** + * @brief View - is the view that is being disconnected from the stage + * + */ + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void KeyInputFocusGainedCallbackDelegate(IntPtr control); + private DaliEventHandler _KeyInputFocusGainedEventHandler; + private KeyInputFocusGainedCallbackDelegate _KeyInputFocusGainedCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void KeyInputFocusLostCallbackDelegate(IntPtr control); + private DaliEventHandler _KeyInputFocusLostEventHandler; + private KeyInputFocusLostCallbackDelegate _KeyInputFocusLostCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool KeyCallbackDelegate(IntPtr control, IntPtr keyEvent); + private DaliEventHandlerWithReturnType _KeyEventHandler; + private KeyCallbackDelegate _KeyCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void OnRelayoutEventCallbackDelegate(IntPtr control); + private DaliEventHandler _viewOnRelayoutEventHandler; + private OnRelayoutEventCallbackDelegate _viewOnRelayoutEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool TouchCallbackDelegate(IntPtr view, IntPtr touchData); + private DaliEventHandlerWithReturnType _viewTouchDataEventHandler; + private TouchCallbackDelegate _viewTouchDataCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool HoverEventCallbackDelegate(IntPtr view, IntPtr hoverEvent); + private DaliEventHandlerWithReturnType _viewHoverEventHandler; + private HoverEventCallbackDelegate _viewHoverEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool WheelEventCallbackDelegate(IntPtr view, IntPtr wheelEvent); + private DaliEventHandlerWithReturnType _viewWheelEventHandler; + private WheelEventCallbackDelegate _viewWheelEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void OnStageEventCallbackDelegate(IntPtr control); + private DaliEventHandler _viewOnStageEventHandler; + private OnStageEventCallbackDelegate _viewOnStageEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void OffStageEventCallbackDelegate(IntPtr control); + private DaliEventHandler _viewOffStageEventHandler; + private OffStageEventCallbackDelegate _viewOffStageEventCallbackDelegate; + + /** + * @brief Event for KeyInputFocusGained signal which can be used to subscribe/unsubscribe the event handler + * (in the type of KeyInputFocusGainedEventHandler-DaliEventHandler) + * provided by the user. KeyInputFocusGained signal is emitted when the control gets Key Input Focus. */ - public View View - { - get + public event DaliEventHandler KeyInputFocusGained + { + add + { + lock(this) + { + // Restricted to only one listener + if (_KeyInputFocusGainedEventHandler == null) + { + _KeyInputFocusGainedEventHandler += value; + Console.WriteLine("View Keyevent EVENT Locked...."); + _KeyInputFocusGainedCallbackDelegate = new KeyInputFocusGainedCallbackDelegate(OnKeyInputFocusGained); + this.KeyInputFocusGainedSignal().Connect(_KeyInputFocusGainedCallbackDelegate); + } + } + } + + remove { - return _view; + lock(this) + { + if (_KeyInputFocusGainedEventHandler != null) + { + this.KeyInputFocusGainedSignal().Disconnect(_KeyInputFocusGainedCallbackDelegate); + } + + _KeyInputFocusGainedEventHandler -= value; + } } - set + } + + private void OnKeyInputFocusGained(IntPtr view) + { + KeyInputFocusGainedEventArgs e = new KeyInputFocusGainedEventArgs(); + Console.WriteLine("View Keyevent ...."); + // Populate all members of "e" (KeyInputFocusGainedEventArgs) with real data + e.View = Dali.View.GetViewFromPtr(view); + + if (_KeyInputFocusGainedEventHandler != null) { - _view = value; + //here we send all data to user event handlers + _KeyInputFocusGainedEventHandler(this, e); } - } - /** - * @brief KeyEvent - is the keyevent sent to the View. - * + } + + /** + * @brief Event for KeyInputFocusLost signal which can be used to subscribe/unsubscribe the event handler + * (in the type of KeyInputFocusLostEventHandler-DaliEventHandler) + * provided by the user. KeyInputFocusLost signal is emitted when the control loses Key Input Focus. */ - public KeyEvent KeyEvent - { - get + public event DaliEventHandler KeyInputFocusLost + { + add { - return _keyEvent; + lock(this) + { + // Restricted to only one listener + if (_KeyInputFocusLostEventHandler == null) + { + _KeyInputFocusLostEventHandler += value; + + _KeyInputFocusLostCallbackDelegate = new KeyInputFocusLostCallbackDelegate(OnKeyInputFocusLost); + this.KeyInputFocusLostSignal().Connect(_KeyInputFocusLostCallbackDelegate); + } + } } - set + + remove { - _keyEvent = value; + lock(this) + { + if (_KeyInputFocusLostEventHandler != null) + { + this.KeyInputFocusLostSignal().Disconnect(_KeyInputFocusLostCallbackDelegate); + } + + _KeyInputFocusLostEventHandler -= value; + } + } + } + + private void OnKeyInputFocusLost(IntPtr view) + { + KeyInputFocusLostEventArgs e = new KeyInputFocusLostEventArgs(); + + // Populate all members of "e" (KeyInputFocusLostEventArgs) with real data + e.View = Dali.View.GetViewFromPtr(view); + + if (_KeyInputFocusLostEventHandler != null) + { + //here we send all data to user event handlers + _KeyInputFocusLostEventHandler(this, e); + } + } + + /** + * @brief Event for KeyPressed signal which can be used to subscribe/unsubscribe the event handler + * (in the type of KeyEventEventHandler-DaliEventHandlerWithReturnType) + * provided by the user. KeyPressed signal is emitted when key event is received. + */ + public event DaliEventHandlerWithReturnType KeyPressed + { + add + { + lock(this) + { + // Restricted to only one listener + if (_KeyEventHandler == null) + { + _KeyEventHandler += value; + + _KeyCallbackDelegate = new KeyCallbackDelegate(OnKeyEvent); + this.KeyEventSignal().Connect(_KeyCallbackDelegate); + } + } } - } -} - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void KeyInputFocusGainedCallbackDelegate(IntPtr control); - private DaliEventHandler _KeyInputFocusGainedEventHandler; - private KeyInputFocusGainedCallbackDelegate _KeyInputFocusGainedCallbackDelegate; - - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void KeyInputFocusLostCallbackDelegate(IntPtr control); - private DaliEventHandler _KeyInputFocusLostEventHandler; - private KeyInputFocusLostCallbackDelegate _KeyInputFocusLostCallbackDelegate; - - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate bool KeyCallbackDelegate(IntPtr control, IntPtr keyEvent); - private DaliEventHandlerWithReturnType _KeyEventHandler; - private KeyCallbackDelegate _KeyCallbackDelegate; - - /** - * @brief Event for KeyInputFocusGained signal which can be used to subscribe/unsubscribe the event handler - * (in the type of KeyInputFocusGainedEventHandler-DaliEventHandler) - * provided by the user. KeyInputFocusGained signal is emitted when the control gets Key Input Focus. - */ - public event DaliEventHandler KeyInputFocusGained - { - add - { + remove + { lock(this) { - // Restricted to only one listener - if (_KeyInputFocusGainedEventHandler == null) - { - _KeyInputFocusGainedEventHandler += value; + if (_KeyEventHandler != null) + { + this.KeyEventSignal().Disconnect(_KeyCallbackDelegate); + } + + _KeyEventHandler -= value; + } + } + } + + private bool OnKeyEvent(IntPtr view, IntPtr keyEvent) + { + KeyEventArgs e = new KeyEventArgs(); + + // Populate all members of "e" (KeyEventArgs) with real data + e.View = Dali.View.GetViewFromPtr(view); + e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr(keyEvent); - _KeyInputFocusGainedCallbackDelegate = new KeyInputFocusGainedCallbackDelegate(OnKeyInputFocusGained); - this.KeyInputFocusGainedSignal().Connect(_KeyInputFocusGainedCallbackDelegate); - } + if (_KeyEventHandler != null) + { + //here we send all data to user event handlers + return _KeyEventHandler(this, e); + } + return false; + + } + + /** + * @brief Event for OnRelayout signal which can be used to subscribe/unsubscribe the event handler + * (in the type of OnRelayoutEventHandler) provided by the user. + * OnRelayout signal is emitted after the size has been set on the view during relayout. + */ + public event DaliEventHandler OnRelayoutEvent + { + add + { + lock(this) + { + // Restricted to only one listener + if (_viewOnRelayoutEventHandler == null) + { + _viewOnRelayoutEventHandler += value; + Console.WriteLine("View OnRelayoutEventArgs Locked...."); + _viewOnRelayoutEventCallbackDelegate = new OnRelayoutEventCallbackDelegate(OnRelayout); + this.OnRelayoutSignal().Connect(_viewOnRelayoutEventCallbackDelegate); + } } - } + } - remove - { + remove + { lock(this) { - if (_KeyInputFocusGainedEventHandler != null) - { - this.KeyInputFocusGainedSignal().Disconnect(_KeyInputFocusGainedCallbackDelegate); - } + if (_viewOnRelayoutEventHandler != null) + { + this.OnRelayoutSignal().Disconnect(_viewOnRelayoutEventCallbackDelegate); + } - _KeyInputFocusGainedEventHandler -= value; + _viewOnRelayoutEventHandler -= value; } - } - } + } + } + + // Callback for View OnRelayout signal + private void OnRelayout(IntPtr data) + { + OnRelayoutEventArgs e = new OnRelayoutEventArgs(); + Console.WriteLine("View OnRelayoutEventArgs...."); + // Populate all members of "e" (OnRelayoutEventArgs) with real data + e.View = View.GetViewFromPtr(data); - private void OnKeyInputFocusGained(IntPtr view) - { - KeyInputFocusGainedEventArgs e = new KeyInputFocusGainedEventArgs(); + if (_viewOnRelayoutEventHandler != null) + { + //here we send all data to user event handlers + _viewOnRelayoutEventHandler(this, e); + } + } + + /** + * @brief Event for Touched signal which can be used to subscribe/unsubscribe the event handler + * (in the type of TouchEventHandler-DaliEventHandlerWithReturnType) + * provided by the user. Touched signal is emitted when touch input is received. + */ + public event DaliEventHandlerWithReturnType Touched + { + add + { + lock(this) + { + // Restricted to only one listener + if (_viewTouchDataEventHandler == null) + { + _viewTouchDataEventHandler += value; + Console.WriteLine("View Touch EVENT LOCKED...."); + _viewTouchDataCallbackDelegate = new TouchCallbackDelegate(OnTouch); + this.TouchSignal().Connect(_viewTouchDataCallbackDelegate); + } + } + } - // Populate all members of "e" (KeyInputFocusGainedEventArgs) with real data - e.View = Dali.View.GetViewFromPtr(view); + remove + { + lock(this) + { + if (_viewTouchDataEventHandler != null) + { + this.TouchSignal().Disconnect(_viewTouchDataCallbackDelegate); + } - if (_KeyInputFocusGainedEventHandler != null) - { - //here we send all data to user event handlers - _KeyInputFocusGainedEventHandler(this, e); - } + _viewTouchDataEventHandler -= value; + } + } + } + + // Callback for View TouchSignal + private bool OnTouch(IntPtr view, IntPtr touchData) + { + TouchEventArgs e = new TouchEventArgs(); + Console.WriteLine("View Touch EVENT...."); + // Populate all members of "e" (TouchEventArgs) with real data + e.View = View.GetViewFromPtr(view); + e.TouchData = Dali.TouchData.GetTouchDataFromPtr(touchData); + + if (_viewTouchDataEventHandler != null) + { + //here we send all data to user event handlers + return _viewTouchDataEventHandler(this, e); + } - } + return false; + } + + /** + * @brief Event for Hovered signal which can be used to subscribe/unsubscribe the event handler + * (in the type of HoverEventHandler-DaliEventHandlerWithReturnType) + * provided by the user. Hovered signal is emitted when hover input is received. + */ + public event DaliEventHandlerWithReturnType Hovered + { + add + { + lock(this) + { + // Restricted to only one listener + if (_viewHoverEventHandler == null) + { + _viewHoverEventHandler += value; + + _viewHoverEventCallbackDelegate = new HoverEventCallbackDelegate(OnHoverEvent); + this.HoveredSignal().Connect(_viewHoverEventCallbackDelegate); + } + } + } - /** - * @brief Event for KeyInputFocusLost signal which can be used to subscribe/unsubscribe the event handler - * (in the type of KeyInputFocusLostEventHandler-DaliEventHandler) - * provided by the user. KeyInputFocusLost signal is emitted when the control loses Key Input Focus. - */ - public event DaliEventHandler KeyInputFocusLost - { - add - { + remove + { lock(this) { - // Restricted to only one listener - if (_KeyInputFocusLostEventHandler == null) - { - _KeyInputFocusLostEventHandler += value; + if (_viewHoverEventHandler != null) + { + this.HoveredSignal().Disconnect(_viewHoverEventCallbackDelegate); + } - _KeyInputFocusLostCallbackDelegate = new KeyInputFocusLostCallbackDelegate(OnKeyInputFocusLost); - this.KeyInputFocusLostSignal().Connect(_KeyInputFocusLostCallbackDelegate); - } + _viewHoverEventHandler -= value; } - } + } + } + + // Callback for View Hover signal + private bool OnHoverEvent(IntPtr view, IntPtr hoverEvent) + { + HoverEventArgs e = new HoverEventArgs(); + + // Populate all members of "e" (HoverEventArgs) with real data + e.View = View.GetViewFromPtr(view); + e.HoverEvent = Dali.HoverEvent.GetHoverEventFromPtr(hoverEvent); + + if (_viewHoverEventHandler != null) + { + //here we send all data to user event handlers + return _viewHoverEventHandler(this, e); + } - remove - { + return false; + } + + /** + * @brief Event for WheelMoved signal which can be used to subscribe/unsubscribe the event handler + * (in the type of WheelEventHandler-DaliEventHandlerWithReturnType) + * provided by the user. WheelMoved signal is emitted when wheel event is received. + */ + public event DaliEventHandlerWithReturnType WheelMoved + { + add + { lock(this) { - if (_KeyInputFocusLostEventHandler != null) - { - this.KeyInputFocusLostSignal().Disconnect(_KeyInputFocusLostCallbackDelegate); - } - - _KeyInputFocusLostEventHandler -= value; - } - } - } - - private void OnKeyInputFocusLost(IntPtr view) - { - KeyInputFocusLostEventArgs e = new KeyInputFocusLostEventArgs(); - - // Populate all members of "e" (KeyInputFocusLostEventArgs) with real data - e.View = Dali.View.GetViewFromPtr(view); - - if (_KeyInputFocusLostEventHandler != null) - { - //here we send all data to user event handlers - _KeyInputFocusLostEventHandler(this, e); - } - } - - /** - * @brief Event for KeyPressed signal which can be used to subscribe/unsubscribe the event handler - * (in the type of KeyEventEventHandler-DaliEventHandlerWithReturnType) - * provided by the user. KeyPressed signal is emitted when key event is received. - */ - public event DaliEventHandlerWithReturnType KeyPressed - { - add - { + // Restricted to only one listener + if (_viewWheelEventHandler == null) + { + _viewWheelEventHandler += value; + Console.WriteLine("View Wheel EVENT LOCKED...."); + _viewWheelEventCallbackDelegate = new WheelEventCallbackDelegate(OnWheelEvent); + this.WheelEventSignal().Connect(_viewWheelEventCallbackDelegate); + } + } + } + + remove + { lock(this) { - // Restricted to only one listener - if (_KeyEventHandler == null) - { - _KeyEventHandler += value; + if (_viewWheelEventHandler != null) + { + this.WheelEventSignal().Disconnect(_viewWheelEventCallbackDelegate); + } + + _viewWheelEventHandler -= value; + } + } + } + + // Callback for View Wheel signal + private bool OnWheelEvent(IntPtr view, IntPtr wheelEvent) + { + WheelEventArgs e = new WheelEventArgs(); + Console.WriteLine("View Wheel EVENT ...."); + // Populate all members of "e" (WheelEventArgs) with real data + e.View = View.GetViewFromPtr(view); + e.WheelEvent = Dali.WheelEvent.GetWheelEventFromPtr(wheelEvent); + + if (_viewWheelEventHandler != null) + { + //here we send all data to user event handlers + return _viewWheelEventHandler(this, e); + } - _KeyCallbackDelegate = new KeyCallbackDelegate(OnKeyEvent); - this.KeyEventSignal().Connect(_KeyCallbackDelegate); - } + return false; + } + + /** + * @brief Event for OnStage signal which can be used to subscribe/unsubscribe the event handler + * (in the type of OnStageEventHandler) provided by the user. + * OnStage signal is emitted after the view has been connected to the stage. + */ + public event DaliEventHandler OnStageEvent + { + add + { + lock(this) + { + // Restricted to only one listener + if (_viewOnStageEventHandler == null) + { + _viewOnStageEventHandler += value; + + _viewOnStageEventCallbackDelegate = new OnStageEventCallbackDelegate(OnStage); + this.OnStageSignal().Connect(_viewOnStageEventCallbackDelegate); + } } - } + } - remove - { + remove + { lock(this) { - if (_KeyEventHandler != null) - { - this.KeyEventSignal().Disconnect(_KeyCallbackDelegate); - } + if (_viewOnStageEventHandler != null) + { + this.OnStageSignal().Disconnect(_viewOnStageEventCallbackDelegate); + } + + _viewOnStageEventHandler -= value; + } + } + } + + // Callback for View OnStage signal + private void OnStage(IntPtr data) + { + OnStageEventArgs e = new OnStageEventArgs(); - _KeyEventHandler -= value; + // Populate all members of "e" (OnStageEventArgs) with real data + e.View = View.GetViewFromPtr(data); + + if (_viewOnStageEventHandler != null) + { + //here we send all data to user event handlers + _viewOnStageEventHandler(this, e); + } + } + + /** + * @brief Event for OffStage signal which can be used to subscribe/unsubscribe the event handler + * (in the type of OffStageEventHandler) provided by the user. + * OffStage signal is emitted after the view has been disconnected from the stage. + */ + public event DaliEventHandler OffStageEvent + { + add + { + lock(this) + { + // Restricted to only one listener + if (_viewOffStageEventHandler == null) + { + _viewOffStageEventHandler += value; + + _viewOffStageEventCallbackDelegate = new OffStageEventCallbackDelegate(OffStage); + this.OnStageSignal().Connect(_viewOffStageEventCallbackDelegate); + } } - } - } + } + + remove + { + lock(this) + { + if (_viewOffStageEventHandler != null) + { + this.OnStageSignal().Disconnect(_viewOffStageEventCallbackDelegate); + } - private bool OnKeyEvent(IntPtr view, IntPtr keyEvent) - { - KeyEventArgs e = new KeyEventArgs(); + _viewOffStageEventHandler -= value; + } + } + } - // Populate all members of "e" (KeyEventArgs) with real data - e.View = Dali.View.GetViewFromPtr(view); - e.KeyEvent = Dali.KeyEvent.GetKeyEventFromPtr(keyEvent); + // Callback for View OffStage signal + private void OffStage(IntPtr data) + { + OffStageEventArgs e = new OffStageEventArgs(); - if (_KeyEventHandler != null) - { - //here we send all data to user event handlers - return _KeyEventHandler(this, e, true); - } - return false; + // Populate all members of "e" (OffStageEventArgs) with real data + e.View = View.GetViewFromPtr(data); - } + if (_viewOffStageEventHandler != null) + { + //here we send all data to user event handlers + _viewOffStageEventHandler(this, e); + } + } - public static View GetViewFromPtr(global::System.IntPtr cPtr) { - View ret = new View(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } + public static View GetViewFromPtr(global::System.IntPtr cPtr) { + View ret = new View(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } -%} + %} -%enddef + %enddef %define DALI_CONTROL_EVENTHANDLER_PARAM( NameSpace, ClassName) CONTROL_EVENTHANDLER_TYPEMAP_EVENTARG( NameSpace, ClassName); CONTROL_EVENTHANDLER_TYPEMAP_HELPER( NameSpace, ClassName); -%enddef + %enddef -namespace Dali + namespace Dali { DALI_CONTROL_EVENTHANDLER_PARAM( Dali::Toolkit, Control); }