From e11fc6396a013aea9c87b10dcf06aae5cafc6152 Mon Sep 17 00:00:00 2001 From: arosis78 <35049857+arosis78@users.noreply.github.com> Date: Wed, 6 Mar 2019 19:30:31 +0900 Subject: [PATCH] [NUI] Added new ViewAdded event on Window (#705) * [NUI] Added new ViewConnected event on Window * [NUI] Added new ViewAdded event on Window * [NUI] Added new ViewAddxxed event on Window --- src/Tizen.NUI/src/public/BaseComponents/View.cs | 15 +++++++++++++++ src/Tizen.NUI/src/public/Window.cs | 13 +++++++++++++ 2 files changed, 28 insertions(+) mode change 100755 => 100644 src/Tizen.NUI/src/public/BaseComponents/View.cs mode change 100755 => 100644 src/Tizen.NUI/src/public/Window.cs diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs old mode 100755 new mode 100644 index 227e2a5..3bcc0b1 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -1284,6 +1284,13 @@ namespace Tizen.NUI.BaseComponents private EventHandler _backgroundResourceLoadedEventHandler; private _backgroundResourceLoadedCallbackType _backgroundResourceLoadedCallback; + private OnWindowEventCallbackType _onWindowSendEventCallback; + + private void SendViewAddedEventToWindow(IntPtr data) + { + Window.Instance.SendViewAdded(this); + } + /// /// Creates a new instance of a view. /// @@ -1305,6 +1312,9 @@ namespace Tizen.NUI.BaseComponents PositionUsesPivotPoint = false; } _mergedStyle = new MergedStyle(GetType(), this); + + _onWindowSendEventCallback = SendViewAddedEventToWindow; + this.OnWindowSignal().Connect(_onWindowSendEventCallback); } internal View(ViewImpl implementation) : this(NDalicPINVOKE.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true) @@ -5200,6 +5210,11 @@ namespace Tizen.NUI.BaseComponents this.ResourcesLoadedSignal().Disconnect(_backgroundResourceLoadedCallback); } + if (_onWindowSendEventCallback != null) + { + this.OnWindowSignal().Disconnect(_onWindowSendEventCallback); + } + // BaseHandle CPtr is used in Registry and there is danger of deletion if we keep using it here. // Restore current CPtr. swigCPtr = currentCPtr; diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs old mode 100755 new mode 100644 index 717ca1f..ba929bf --- a/src/Tizen.NUI/src/public/Window.cs +++ b/src/Tizen.NUI/src/public/Window.cs @@ -280,6 +280,19 @@ namespace Tizen.NUI } } + /// + /// ViewAdded will be triggered when the view added on Window + /// + /// 6 + /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler ViewAdded; + + internal void SendViewAdded(View view) + { + ViewAdded?.Invoke(view, EventArgs.Empty); + } + internal event EventHandler EventProcessingFinished { add -- 2.7.4