2 * Copyright(c) 2019 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.
19 using System.ComponentModel;
20 using System.Runtime.InteropServices;
21 using Tizen.NUI.Components;
23 namespace Tizen.NUI.BaseComponents
26 /// View is the base class for all views.
28 /// <since_tizen> 3 </since_tizen>
29 public partial class View
31 private EventHandler _offWindowEventHandler;
32 private OffWindowEventCallbackType _offWindowEventCallback;
33 private EventHandlerWithReturnType<object, WheelEventArgs, bool> _wheelEventHandler;
34 private WheelEventCallbackType _wheelEventCallback;
35 private EventHandlerWithReturnType<object, KeyEventArgs, bool> _keyEventHandler;
36 private KeyCallbackType _keyCallback;
37 private EventHandlerWithReturnType<object, TouchEventArgs, bool> _touchDataEventHandler;
38 private TouchDataCallbackType _touchDataCallback;
39 private EventHandlerWithReturnType<object, HoverEventArgs, bool> _hoverEventHandler;
40 private HoverEventCallbackType _hoverEventCallback;
41 private EventHandler<VisibilityChangedEventArgs> _visibilityChangedEventHandler;
42 private VisibilityChangedEventCallbackType _visibilityChangedEventCallback;
43 private EventHandler _keyInputFocusGainedEventHandler;
44 private KeyInputFocusGainedCallbackType _keyInputFocusGainedCallback;
45 private EventHandler _keyInputFocusLostEventHandler;
46 private KeyInputFocusLostCallbackType _keyInputFocusLostCallback;
47 private EventHandler _onRelayoutEventHandler;
48 private OnRelayoutEventCallbackType _onRelayoutEventCallback;
49 private EventHandler _onWindowEventHandler;
50 private OnWindowEventCallbackType _onWindowEventCallback;
51 private EventHandler<LayoutDirectionChangedEventArgs> _layoutDirectionChangedEventHandler;
52 private LayoutDirectionChangedEventCallbackType _layoutDirectionChangedEventCallback;
53 // Resource Ready Signal
54 private EventHandler _resourcesLoadedEventHandler;
55 private ResourcesLoadedCallbackType _ResourcesLoadedCallback;
56 private EventHandler<BackgroundResourceLoadedEventArgs> _backgroundResourceLoadedEventHandler;
57 private _backgroundResourceLoadedCallbackType _backgroundResourceLoadedCallback;
59 private OnWindowEventCallbackType _onWindowSendEventCallback;
61 private void SendViewAddedEventToWindow(IntPtr data)
63 NUIApplication.GetDefaultWindow()?.SendViewAdded(this);
66 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
67 private delegate void OffWindowEventCallbackType(IntPtr control);
68 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
69 private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent);
70 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
71 private delegate bool KeyCallbackType(IntPtr control, IntPtr keyEvent);
72 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
73 private delegate bool TouchDataCallbackType(IntPtr view, IntPtr touchData);
74 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
75 private delegate bool HoverEventCallbackType(IntPtr view, IntPtr hoverEvent);
76 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
77 private delegate void VisibilityChangedEventCallbackType(IntPtr data, bool visibility, VisibilityChangeType type);
78 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
79 private delegate void ResourcesLoadedCallbackType(IntPtr control);
80 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
81 private delegate void _backgroundResourceLoadedCallbackType(IntPtr view);
82 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
83 private delegate void KeyInputFocusGainedCallbackType(IntPtr control);
84 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
85 private delegate void KeyInputFocusLostCallbackType(IntPtr control);
86 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
87 private delegate void OnRelayoutEventCallbackType(IntPtr control);
88 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
89 private delegate void OnWindowEventCallbackType(IntPtr control);
90 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
91 private delegate void LayoutDirectionChangedEventCallbackType(IntPtr data, ViewLayoutDirectionType type);
94 /// Event when a child is removed.
96 /// <since_tizen> 5 </since_tizen>
97 public new event EventHandler<ChildRemovedEventArgs> ChildRemoved;
99 /// Event when a child is added.
101 /// <since_tizen> 5 </since_tizen>
102 public new event EventHandler<ChildAddedEventArgs> ChildAdded;
105 /// An event for the KeyInputFocusGained signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
106 /// The KeyInputFocusGained signal is emitted when the control gets the key input focus.<br />
108 /// <since_tizen> 3 </since_tizen>
109 public event EventHandler FocusGained
113 if (_keyInputFocusGainedEventHandler == null)
115 _keyInputFocusGainedCallback = OnKeyInputFocusGained;
116 this.KeyInputFocusGainedSignal().Connect(_keyInputFocusGainedCallback);
119 _keyInputFocusGainedEventHandler += value;
124 _keyInputFocusGainedEventHandler -= value;
126 if (_keyInputFocusGainedEventHandler == null && KeyInputFocusGainedSignal().Empty() == false)
128 this.KeyInputFocusGainedSignal().Disconnect(_keyInputFocusGainedCallback);
134 /// An event for the KeyInputFocusLost signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
135 /// The KeyInputFocusLost signal is emitted when the control loses the key input focus.<br />
137 /// <since_tizen> 3 </since_tizen>
138 public event EventHandler FocusLost
142 if (_keyInputFocusLostEventHandler == null)
144 _keyInputFocusLostCallback = OnKeyInputFocusLost;
145 this.KeyInputFocusLostSignal().Connect(_keyInputFocusLostCallback);
148 _keyInputFocusLostEventHandler += value;
153 _keyInputFocusLostEventHandler -= value;
155 if (_keyInputFocusLostEventHandler == null && KeyInputFocusLostSignal().Empty() == false)
157 this.KeyInputFocusLostSignal().Disconnect(_keyInputFocusLostCallback);
163 /// An event for the KeyPressed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
164 /// The KeyPressed signal is emitted when the key event is received.<br />
166 /// <since_tizen> 3 </since_tizen>
167 public event EventHandlerWithReturnType<object, KeyEventArgs, bool> KeyEvent
171 if (_keyEventHandler == null)
173 _keyCallback = OnKeyEvent;
174 this.KeyEventSignal().Connect(_keyCallback);
177 _keyEventHandler += value;
182 _keyEventHandler -= value;
184 if (_keyEventHandler == null && KeyEventSignal().Empty() == false)
186 this.KeyEventSignal().Disconnect(_keyCallback);
192 /// An event for the OnRelayout signal which can be used to subscribe or unsubscribe the event handler.<br />
193 /// The OnRelayout signal is emitted after the size has been set on the view during relayout.<br />
195 /// <since_tizen> 3 </since_tizen>
196 public event EventHandler Relayout
200 if (_onRelayoutEventHandler == null)
202 _onRelayoutEventCallback = OnRelayout;
203 this.OnRelayoutSignal().Connect(_onRelayoutEventCallback);
206 _onRelayoutEventHandler += value;
211 _onRelayoutEventHandler -= value;
213 if (_onRelayoutEventHandler == null && OnRelayoutSignal().Empty() == false)
215 this.OnRelayoutSignal().Disconnect(_onRelayoutEventCallback);
222 /// An event for the touched signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
223 /// The touched signal is emitted when the touch input is received.<br />
225 /// <since_tizen> 3 </since_tizen>
226 public event EventHandlerWithReturnType<object, TouchEventArgs, bool> TouchEvent
230 if (_touchDataEventHandler == null)
232 _touchDataCallback = OnTouch;
233 this.TouchSignal().Connect(_touchDataCallback);
236 _touchDataEventHandler += value;
241 _touchDataEventHandler -= value;
243 if (_touchDataEventHandler == null && TouchSignal().Empty() == false)
245 this.TouchSignal().Disconnect(_touchDataCallback);
252 /// An event for the hovered signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
253 /// The hovered signal is emitted when the hover input is received.<br />
255 /// <since_tizen> 3 </since_tizen>
256 public event EventHandlerWithReturnType<object, HoverEventArgs, bool> HoverEvent
260 if (_hoverEventHandler == null)
262 _hoverEventCallback = OnHoverEvent;
263 this.HoveredSignal().Connect(_hoverEventCallback);
266 _hoverEventHandler += value;
271 _hoverEventHandler -= value;
273 if (_hoverEventHandler == null && HoveredSignal().Empty() == false)
275 this.HoveredSignal().Disconnect(_hoverEventCallback);
282 /// An event for the WheelMoved signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
283 /// The WheelMoved signal is emitted when the wheel event is received.<br />
285 /// <since_tizen> 3 </since_tizen>
286 public event EventHandlerWithReturnType<object, WheelEventArgs, bool> WheelEvent
290 if (_wheelEventHandler == null)
292 _wheelEventCallback = OnWheelEvent;
293 this.WheelEventSignal().Connect(_wheelEventCallback);
295 _wheelEventHandler += value;
297 if (WindowWheelEventHandler == null)
299 NUIApplication.GetDefaultWindow().WheelEvent += OnWindowWheelEvent;
301 WindowWheelEventHandler += value;
306 _wheelEventHandler -= value;
307 if (_wheelEventHandler == null && WheelEventSignal().Empty() == false)
309 this.WheelEventSignal().Disconnect(_wheelEventCallback);
312 WindowWheelEventHandler -= value;
313 if (WindowWheelEventHandler == null)
315 NUIApplication.GetDefaultWindow().WheelEvent -= OnWindowWheelEvent;
321 /// An event for the OnWindow signal which can be used to subscribe or unsubscribe the event handler.<br />
322 /// The OnWindow signal is emitted after the view has been connected to the window.<br />
324 /// <since_tizen> 3 </since_tizen>
325 public event EventHandler AddedToWindow
329 if (_onWindowEventHandler == null)
331 _onWindowEventCallback = OnWindow;
332 this.OnWindowSignal().Connect(_onWindowEventCallback);
335 _onWindowEventHandler += value;
340 _onWindowEventHandler -= value;
342 if (_onWindowEventHandler == null && OnWindowSignal().Empty() == false)
344 this.OnWindowSignal().Disconnect(_onWindowEventCallback);
350 /// An event for the OffWindow signal, which can be used to subscribe or unsubscribe the event handler.<br />
351 /// OffWindow signal is emitted after the view has been disconnected from the window.<br />
353 /// <since_tizen> 3 </since_tizen>
354 public event EventHandler RemovedFromWindow
358 if (_offWindowEventHandler == null)
360 _offWindowEventCallback = OffWindow;
361 this.OffWindowSignal().Connect(_offWindowEventCallback);
364 _offWindowEventHandler += value;
369 _offWindowEventHandler -= value;
371 if (_offWindowEventHandler == null && OffWindowSignal().Empty() == false)
373 this.OffWindowSignal().Disconnect(_offWindowEventCallback);
379 /// An event for visibility change which can be used to subscribe or unsubscribe the event handler.<br />
380 /// This signal is emitted when the visible property of this or a parent view is changed.<br />
382 /// <since_tizen> 3 </since_tizen>
383 public event EventHandler<VisibilityChangedEventArgs> VisibilityChanged
387 if (_visibilityChangedEventHandler == null)
389 _visibilityChangedEventCallback = OnVisibilityChanged;
390 VisibilityChangedSignal(this).Connect(_visibilityChangedEventCallback);
393 _visibilityChangedEventHandler += value;
398 _visibilityChangedEventHandler -= value;
400 if (_visibilityChangedEventHandler == null && VisibilityChangedSignal(this).Empty() == false)
402 VisibilityChangedSignal(this).Disconnect(_visibilityChangedEventCallback);
408 /// Event for layout direction change which can be used to subscribe/unsubscribe the event handler.<br />
409 /// This signal is emitted when the layout direction property of this or a parent view is changed.<br />
411 /// <since_tizen> 4 </since_tizen>
412 public event EventHandler<LayoutDirectionChangedEventArgs> LayoutDirectionChanged
416 if (_layoutDirectionChangedEventHandler == null)
418 _layoutDirectionChangedEventCallback = OnLayoutDirectionChanged;
419 LayoutDirectionChangedSignal(this).Connect(_layoutDirectionChangedEventCallback);
422 _layoutDirectionChangedEventHandler += value;
427 _layoutDirectionChangedEventHandler -= value;
429 if (_layoutDirectionChangedEventHandler == null && LayoutDirectionChangedSignal(this).Empty() == false)
431 LayoutDirectionChangedSignal(this).Disconnect(_layoutDirectionChangedEventCallback);
437 /// An event for the ResourcesLoadedSignal signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
438 /// This signal is emitted after all resources required by a view are loaded and ready.<br />
440 /// <since_tizen> 3 </since_tizen>
441 public event EventHandler ResourcesLoaded
445 if (_resourcesLoadedEventHandler == null)
447 _ResourcesLoadedCallback = OnResourcesLoaded;
448 this.ResourcesLoadedSignal().Connect(_ResourcesLoadedCallback);
451 _resourcesLoadedEventHandler += value;
456 _resourcesLoadedEventHandler -= value;
458 if (_resourcesLoadedEventHandler == null && ResourcesLoadedSignal().Empty() == false)
460 this.ResourcesLoadedSignal().Disconnect(_ResourcesLoadedCallback);
465 private EventHandler _backKeyPressed;
468 /// An event for getting notice when physical back key is pressed.<br />
469 /// This event is emitted BackKey is up.<br />
471 [EditorBrowsable(EditorBrowsableState.Never)]
472 public event EventHandler BackKeyPressed
476 _backKeyPressed += value;
477 BackKeyManager.Instance.Subscriber.Add(this);
482 BackKeyManager.Instance.Subscriber.Remove(this);
483 _backKeyPressed -= value;
488 /// Function for emitting BackKeyPressed event outside of View instance
490 [EditorBrowsable(EditorBrowsableState.Never)]
491 internal void EmitBackKeyPressed()
493 _backKeyPressed.Invoke(this,null);
497 internal event EventHandler<BackgroundResourceLoadedEventArgs> BackgroundResourceLoaded
501 if (_backgroundResourceLoadedEventHandler == null)
503 _backgroundResourceLoadedCallback = OnBackgroundResourceLoaded;
504 this.ResourcesLoadedSignal().Connect(_backgroundResourceLoadedCallback);
507 _backgroundResourceLoadedEventHandler += value;
511 _backgroundResourceLoadedEventHandler -= value;
513 if (_backgroundResourceLoadedEventHandler == null && ResourcesLoadedSignal().Empty() == false)
515 this.ResourcesLoadedSignal().Disconnect(_backgroundResourceLoadedCallback);
520 internal TouchDataSignal TouchSignal()
522 TouchDataSignal ret = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(swigCPtr), false);
523 if (NDalicPINVOKE.SWIGPendingException.Pending)
524 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
528 internal HoverSignal HoveredSignal()
530 HoverSignal ret = new HoverSignal(Interop.ActorSignal.Actor_HoveredSignal(swigCPtr), false);
531 if (NDalicPINVOKE.SWIGPendingException.Pending)
532 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
536 internal WheelSignal WheelEventSignal()
538 WheelSignal ret = new WheelSignal(Interop.ActorSignal.Actor_WheelEventSignal(swigCPtr), false);
539 if (NDalicPINVOKE.SWIGPendingException.Pending)
540 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
544 internal ViewSignal OnWindowSignal()
546 ViewSignal ret = new ViewSignal(Interop.ActorSignal.Actor_OnStageSignal(swigCPtr), false);
547 if (NDalicPINVOKE.SWIGPendingException.Pending)
548 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
552 internal ViewSignal OffWindowSignal()
554 ViewSignal ret = new ViewSignal(Interop.ActorSignal.Actor_OffStageSignal(swigCPtr), false);
555 if (NDalicPINVOKE.SWIGPendingException.Pending)
556 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
560 internal ViewSignal OnRelayoutSignal()
562 ViewSignal ret = new ViewSignal(Interop.ActorSignal.Actor_OnRelayoutSignal(swigCPtr), false);
563 if (NDalicPINVOKE.SWIGPendingException.Pending)
564 throw NDalicPINVOKE.SWIGPendingException.Retrieve();
568 internal ViewVisibilityChangedSignal VisibilityChangedSignal(View view)
570 ViewVisibilityChangedSignal ret = new ViewVisibilityChangedSignal(Interop.NDalic.VisibilityChangedSignal(View.getCPtr(view)), false);
571 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
575 internal ViewLayoutDirectionChangedSignal LayoutDirectionChangedSignal(View view)
577 ViewLayoutDirectionChangedSignal ret = new ViewLayoutDirectionChangedSignal(Interop.Layout.LayoutDirectionChangedSignal(View.getCPtr(view)), false);
578 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
582 internal ViewSignal ResourcesLoadedSignal()
584 ViewSignal ret = new ViewSignal(Interop.View.ResourceReadySignal(swigCPtr), false);
585 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
589 internal ControlKeySignal KeyEventSignal()
591 ControlKeySignal ret = new ControlKeySignal(Interop.ViewSignal.View_KeyEventSignal(swigCPtr), false);
592 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
596 internal KeyInputFocusSignal KeyInputFocusGainedSignal()
598 KeyInputFocusSignal ret = new KeyInputFocusSignal(Interop.ViewSignal.View_KeyInputFocusGainedSignal(swigCPtr), false);
599 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
603 internal KeyInputFocusSignal KeyInputFocusLostSignal()
605 KeyInputFocusSignal ret = new KeyInputFocusSignal(Interop.ViewSignal.View_KeyInputFocusLostSignal(swigCPtr), false);
606 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
610 private void OnSize2DChanged(int width, int height)
612 Size2D = new Size2D(width, height);
615 private void OnMinimumSizeChanged(int width, int height)
617 MinimumSize = new Size2D(width, height);
620 private void OnMaximumSizeChanged(int width, int height)
622 MaximumSize = new Size2D(width, height);
625 private void OnPosition2DChanged(int x, int y)
627 Position2D = new Position2D(x, y);
630 private void OnSizeChanged(float width, float height, float depth)
632 Size = new Size(width, height, depth);
635 private void OnPositionChanged(float x, float y, float z)
637 Position = new Position(x, y, z);
640 private void OnParentOriginChanged(float x, float y, float z)
642 ParentOrigin = new Position(x, y, z);
645 private void OnPivotPointChanged(float x, float y, float z)
647 PivotPoint = new Position(x, y, z);
650 private void OnImageShadowChanged(ShadowBase instance)
652 ImageShadow = (ImageShadow)instance;
655 private void OnBoxShadowChanged(ShadowBase instance)
657 BoxShadow = (Shadow)instance;
660 private void OnBackgroundImageBorderChanged(int left, int right, int bottom, int top)
662 BackgroundImageBorder = new Rectangle(left, right, bottom, top);
665 private void OnKeyInputFocusGained(IntPtr view)
667 if (_keyInputFocusGainedEventHandler != null)
669 _keyInputFocusGainedEventHandler(this, null);
673 private void OnKeyInputFocusLost(IntPtr view)
675 if (_keyInputFocusLostEventHandler != null)
677 _keyInputFocusLostEventHandler(this, null);
681 private bool OnKeyEvent(IntPtr view, IntPtr keyEvent)
683 if (keyEvent == global::System.IntPtr.Zero)
685 NUILog.Error("keyEvent should not be null!");
689 KeyEventArgs e = new KeyEventArgs();
693 e.Key = Tizen.NUI.Key.GetKeyFromPtr(keyEvent);
695 if (_keyEventHandler != null)
697 Delegate[] delegateList = _keyEventHandler.GetInvocationList();
699 // Oring the result of each callback.
700 foreach (EventHandlerWithReturnType<object, KeyEventArgs, bool> del in delegateList)
702 result |= del(this, e);
709 // Callback for View OnRelayout signal
710 private void OnRelayout(IntPtr data)
712 if (_onRelayoutEventHandler != null)
714 _onRelayoutEventHandler(this, null);
718 // Callback for View TouchSignal
719 private bool OnTouch(IntPtr view, IntPtr touchData)
721 if (touchData == global::System.IntPtr.Zero)
723 NUILog.Error("touchData should not be null!");
727 TouchEventArgs e = new TouchEventArgs();
729 e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData);
731 if (_touchDataEventHandler != null)
733 return _touchDataEventHandler(this, e);
738 // Callback for View Hover signal
739 private bool OnHoverEvent(IntPtr view, IntPtr hoverEvent)
741 if (hoverEvent == global::System.IntPtr.Zero)
743 NUILog.Error("hoverEvent should not be null!");
747 HoverEventArgs e = new HoverEventArgs();
749 e.Hover = Tizen.NUI.Hover.GetHoverFromPtr(hoverEvent);
751 if (_hoverEventHandler != null)
753 return _hoverEventHandler(this, e);
758 // Callback for View Wheel signal
759 private bool OnWheelEvent(IntPtr view, IntPtr wheelEvent)
761 if (wheelEvent == global::System.IntPtr.Zero)
763 NUILog.Error("wheelEvent should not be null!");
767 WheelEventArgs e = new WheelEventArgs();
769 e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent);
771 if (_wheelEventHandler != null)
773 return _wheelEventHandler(this, e);
778 // Callback for View OnWindow signal
779 private void OnWindow(IntPtr data)
781 if (_onWindowEventHandler != null)
783 _onWindowEventHandler(this, null);
787 // Callback for View OffWindow signal
788 private void OffWindow(IntPtr data)
790 if (_offWindowEventHandler != null)
792 _offWindowEventHandler(this, null);
796 // Callback for View visibility change signal
797 private void OnVisibilityChanged(IntPtr data, bool visibility, VisibilityChangeType type)
799 VisibilityChangedEventArgs e = new VisibilityChangedEventArgs();
802 e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
804 e.Visibility = visibility;
807 if (_visibilityChangedEventHandler != null)
809 _visibilityChangedEventHandler(this, e);
813 // Callback for View layout direction change signal
814 private void OnLayoutDirectionChanged(IntPtr data, ViewLayoutDirectionType type)
816 LayoutDirectionChangedEventArgs e = new LayoutDirectionChangedEventArgs();
819 e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View;
823 if (_layoutDirectionChangedEventHandler != null)
825 _layoutDirectionChangedEventHandler(this, e);
829 private void OnResourcesLoaded(IntPtr view)
831 if (_resourcesLoadedEventHandler != null)
833 _resourcesLoadedEventHandler(this, null);
837 private void OnBackgroundResourceLoaded(IntPtr view)
839 BackgroundResourceLoadedEventArgs e = new BackgroundResourceLoadedEventArgs();
840 e.Status = (ResourceLoadingStatusType)Interop.View.View_GetVisualResourceStatus(this.swigCPtr, Property.BACKGROUND);
842 if (_backgroundResourceLoadedEventHandler != null)
844 _backgroundResourceLoadedEventHandler(this, e);
849 /// Event argument passed through the ChildAdded event.
851 /// <since_tizen> 5 </since_tizen>
852 public class ChildAddedEventArgs : EventArgs
855 /// Added child view at moment.
857 /// <since_tizen> 5 </since_tizen>
858 public View Added { get; set; }
862 /// Event argument passed through the ChildRemoved event.
864 /// <since_tizen> 5 </since_tizen>
865 public class ChildRemovedEventArgs : EventArgs
868 /// Removed child view at moment.
870 /// <since_tizen> 5 </since_tizen>
871 public View Removed { get; set; }
875 /// Event arguments that passed via the KeyEvent signal.
877 /// <since_tizen> 3 </since_tizen>
878 public class KeyEventArgs : EventArgs
883 /// Key - is the key sent to the view.
885 /// <since_tizen> 3 </since_tizen>
900 /// Event arguments that passed via the touch signal.
902 /// <since_tizen> 3 </since_tizen>
903 public class TouchEventArgs : EventArgs
905 private Touch _touch;
908 /// Touch - contains the information of touch points.
910 /// <since_tizen> 3 </since_tizen>
925 /// Event arguments that passed via the hover signal.
927 /// <since_tizen> 3 </since_tizen>
928 public class HoverEventArgs : EventArgs
930 private Hover _hover;
933 /// Hover - contains touch points that represent the points that are currently being hovered or the points where a hover has stopped.
935 /// <since_tizen> 3 </since_tizen>
950 /// Event arguments that passed via the wheel signal.
952 /// <since_tizen> 3 </since_tizen>
953 public class WheelEventArgs : EventArgs
955 private Wheel _wheel;
958 /// WheelEvent - store a wheel rolling type: MOUSE_WHEEL or CUSTOM_WHEEL.
960 /// <since_tizen> 3 </since_tizen>
975 /// Event arguments of visibility changed.
977 /// <since_tizen> 3 </since_tizen>
978 public class VisibilityChangedEventArgs : EventArgs
981 private bool _visibility;
982 private VisibilityChangeType _type;
985 /// The view, or child of view, whose visibility has changed.
987 /// <since_tizen> 3 </since_tizen>
1001 /// Whether the view is now visible or not.
1003 /// <since_tizen> 3 </since_tizen>
1004 public bool Visibility
1012 _visibility = value;
1017 /// Whether the view's visible property has changed or a parent's.
1019 /// <since_tizen> 3 </since_tizen>
1020 public VisibilityChangeType Type
1034 /// Event arguments of layout direction changed.
1036 /// <since_tizen> 4 </since_tizen>
1037 public class LayoutDirectionChangedEventArgs : EventArgs
1040 private ViewLayoutDirectionType _type;
1043 /// The view, or child of view, whose layout direction has changed.
1045 /// <since_tizen> 4 </since_tizen>
1059 /// Whether the view's layout direction property has changed or a parent's.
1061 /// <since_tizen> 4 </since_tizen>
1062 public ViewLayoutDirectionType Type
1075 internal class BackgroundResourceLoadedEventArgs : EventArgs
1077 private ResourceLoadingStatusType status = ResourceLoadingStatusType.Invalid;
1078 public ResourceLoadingStatusType Status
1092 /// The class represents the information of the situation where the View's control state changes.
1094 [EditorBrowsable(EditorBrowsableState.Never)]
1095 public class ControlStateChangedEventArgs : EventArgs
1098 /// Create an instance with mandatory fields.
1100 /// <param name="previousState">The previous control state.</param>
1101 /// <param name="currentState">The current control state.</param>
1102 [EditorBrowsable(EditorBrowsableState.Never)]
1103 public ControlStateChangedEventArgs(ControlState previousState, ControlState currentState)
1105 PreviousState = previousState;
1106 CurrentState = currentState;
1110 /// The previous control state.
1112 [EditorBrowsable(EditorBrowsableState.Never)]
1113 public ControlState PreviousState { get; }
1116 /// The current control state.
1118 [EditorBrowsable(EditorBrowsableState.Never)]
1119 public ControlState CurrentState { get; }
1122 private EventHandlerWithReturnType<object, WheelEventArgs, bool> WindowWheelEventHandler;
1123 private void OnWindowWheelEvent(object sender, Window.WheelEventArgs e)
1127 if(e.Wheel.Type == Wheel.WheelType.CustomWheel)
1129 var arg = new WheelEventArgs()
1133 WindowWheelEventHandler?.Invoke(this, arg);