From ab2ff589b8457cac3a8984003765bb1ce91410f6 Mon Sep 17 00:00:00 2001 From: Umar Date: Fri, 23 Jun 2017 17:14:50 +0100 Subject: [PATCH] Support for as keyword instead of DownCast Change-Id: I81ce0ec9639b6759f7cb02213e78b547260a6deb --- .../examples/control-dashboard.cs | 4 +- .../NUISamples.TizenTV/examples/dali-test.cs | 19 ++++---- .../date-picker-using-json.cs | 6 +-- src/Tizen.NUI/src/internal/AccessibilityManager.cs | 8 ++-- src/Tizen.NUI/src/internal/Alignment.cs | 3 -- .../src/internal/CustomAlgorithmInterface.cs | 5 +- src/Tizen.NUI/src/internal/GaussianBlurView.cs | 13 +---- src/Tizen.NUI/src/internal/ItemView.cs | 3 -- .../src/internal/LongPressGestureDetector.cs | 2 +- src/Tizen.NUI/src/internal/Model3dView.cs | 3 -- src/Tizen.NUI/src/internal/NDalicPINVOKE.cs | 4 ++ .../src/internal/PageTurnLandscapeView.cs | 3 -- src/Tizen.NUI/src/internal/PageTurnPortraitView.cs | 3 -- src/Tizen.NUI/src/internal/PageTurnView.cs | 3 -- src/Tizen.NUI/src/internal/PanGestureDetector.cs | 2 +- src/Tizen.NUI/src/internal/PinchGestureDetector.cs | 2 +- src/Tizen.NUI/src/internal/Registry.cs | 24 +++++----- src/Tizen.NUI/src/internal/Slider.cs | 3 -- src/Tizen.NUI/src/internal/TapGestureDetector.cs | 2 +- src/Tizen.NUI/src/public/AlphaFunction.cs | 2 - src/Tizen.NUI/src/public/Animation.cs | 7 --- .../src/public/BaseComponents/ImageView.cs | 15 +----- .../src/public/BaseComponents/TextEditor.cs | 24 +--------- .../src/public/BaseComponents/TextField.cs | 24 +--------- .../src/public/BaseComponents/TextLabel.cs | 12 ----- src/Tizen.NUI/src/public/BaseComponents/View.cs | 56 ++++++---------------- src/Tizen.NUI/src/public/BaseHandle.cs | 6 +++ src/Tizen.NUI/src/public/Color.cs | 2 - src/Tizen.NUI/src/public/Degree.cs | 4 +- src/Tizen.NUI/src/public/FlexContainer.cs | 7 --- src/Tizen.NUI/src/public/FocusManager.cs | 45 +++++++++-------- src/Tizen.NUI/src/public/Geometry.cs | 7 --- src/Tizen.NUI/src/public/Gesture.cs | 2 - src/Tizen.NUI/src/public/Hover.cs | 2 - src/Tizen.NUI/src/public/Key.cs | 2 - src/Tizen.NUI/src/public/KeyFrames.cs | 13 ----- src/Tizen.NUI/src/public/Layer.cs | 21 +------- src/Tizen.NUI/src/public/Position.cs | 2 - src/Tizen.NUI/src/public/Position2D.cs | 2 - src/Tizen.NUI/src/public/ProgressBar.cs | 14 +----- src/Tizen.NUI/src/public/Property.cs | 10 ---- src/Tizen.NUI/src/public/PropertyBuffer.cs | 7 --- src/Tizen.NUI/src/public/Radian.cs | 2 - src/Tizen.NUI/src/public/Rectangle.cs | 2 - src/Tizen.NUI/src/public/RelativeVector2.cs | 2 - src/Tizen.NUI/src/public/RelativeVector3.cs | 2 - src/Tizen.NUI/src/public/RelativeVector4.cs | 4 +- src/Tizen.NUI/src/public/RelayoutContainer.cs | 2 - src/Tizen.NUI/src/public/Renderer.cs | 7 --- src/Tizen.NUI/src/public/Rotation.cs | 2 - src/Tizen.NUI/src/public/Sampler.cs | 7 --- src/Tizen.NUI/src/public/Scrollable.cs | 10 ---- src/Tizen.NUI/src/public/Shader.cs | 7 --- src/Tizen.NUI/src/public/Size2D.cs | 2 - src/Tizen.NUI/src/public/StyleManager.cs | 9 +--- src/Tizen.NUI/src/public/TableView.cs | 16 ------- src/Tizen.NUI/src/public/Texture.cs | 7 --- src/Tizen.NUI/src/public/TextureSet.cs | 7 --- src/Tizen.NUI/src/public/Timer.cs | 12 ----- src/Tizen.NUI/src/public/TransitionData.cs | 6 --- src/Tizen.NUI/src/public/UIComponents/Button.cs | 25 ---------- .../src/public/UIComponents/CheckBoxButton.cs | 9 +--- src/Tizen.NUI/src/public/UIComponents/Popup.cs | 17 ------- .../src/public/UIComponents/PushButton.cs | 14 ------ .../src/public/UIComponents/RadioButton.cs | 19 -------- src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs | 14 ------ .../src/public/UIComponents/ScrollView.cs | 10 ---- .../src/public/UIComponents/ToggleButton.cs | 10 ---- src/Tizen.NUI/src/public/Vector2.cs | 2 - src/Tizen.NUI/src/public/Vector3.cs | 2 - src/Tizen.NUI/src/public/Vector4.cs | 2 - src/Tizen.NUI/src/public/VideoView.cs | 24 +--------- src/Tizen.NUI/src/public/ViewWrapper.cs | 10 ---- src/Tizen.NUI/src/public/Wheel.cs | 2 - 74 files changed, 98 insertions(+), 566 deletions(-) diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/control-dashboard.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/control-dashboard.cs index d876810..d76e91a 100644 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/control-dashboard.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/control-dashboard.cs @@ -123,7 +123,7 @@ namespace ControlDashboard { if (!e.ProposedView && !e.CurrentView) { - e.ProposedView = View.DownCast(_contentContainer.GetChildAt(1)); + e.ProposedView = _contentContainer.GetChildAt(1); } return e.ProposedView; } @@ -336,7 +336,7 @@ namespace ControlDashboard { _window.Add(_popup); _popup.SetDisplayState(Popup.DisplayStateType.Shown); - FocusManager.Instance.SetCurrentFocusView(View.DownCast((_popup.FindChildByName("Footer")).FindChildByName("OKButton"))); + FocusManager.Instance.SetCurrentFocusView((_popup.FindChildByName("Footer")).FindChildByName("OKButton")); return true; }; _contentContainer.AddChild(button, new TableView.CellPosition(((uint)idx / 5) * 2 + 1, (uint)idx % 5)); diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/dali-test.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/dali-test.cs index 6a43310..be7571d 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/dali-test.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/dali-test.cs @@ -608,8 +608,8 @@ namespace DaliTest view2.Focusable = true; view1.RightFocusableView = view2; view2.LeftFocusableView = view1; - Window.Add(view1); - Window.Add(view2); + Window.Instance.Add(view1); + Window.Instance.Add(view2); FocusManager.Instance.SetCurrentFocusView(view1); PushButton button = new PushButton(); @@ -627,7 +627,7 @@ namespace DaliTest FocusManager.Instance.MoveFocusBackward(); return true; }; - Window.Add(button); + Window.Instance.Add(button); } public void WindowDevelPropertyTest() @@ -748,7 +748,7 @@ namespace DaliTest View myLabelView = container.FindChildByName("MyLabelName"); if(myLabelView) { - TextLabel newLabel = View.DownCast(myLabelView); + TextLabel newLabel = myLabelView as TextLabel; if(newLabel) { Tizen.Log.Debug("NUI", "Downcast to TextLabel successful: newLabel Name = " + newLabel.Name + ", Text = " + newLabel.Text); @@ -772,7 +772,7 @@ namespace DaliTest View myViewView = container.FindChildByName("MyViewName"); if(myViewView) { - MyView newView = View.DownCast(myViewView); + MyView newView = myViewView as MyView; if(newView) { Tizen.Log.Debug("NUI", "Downcast to MyView successful: newView Name = " + newView.Name + ", MyOwnName = " + newView.MyOwnName + ", myCurrentValue = " + newView._myCurrentValue); @@ -797,7 +797,7 @@ namespace DaliTest View myButtonView = container.FindChildByName("MyButtonName"); if(myButtonView) { - MyButton newButton = View.DownCast(myButtonView); + MyButton newButton = myButtonView as MyButton; if(newButton) { Tizen.Log.Debug("NUI", "Downcast to MyButton successful: newButton Name = " + newButton.Name + ", MyOwnName = " + newButton.MyOwnName + ", LabelText = " + myButton.LabelText + ", myCurrentValue = " + newButton._myCurrentValue); @@ -820,7 +820,7 @@ namespace DaliTest View spinView = container.FindChildByName("SpinName"); if(spinView) { - Spin newSpin = View.DownCast(spinView); + Spin newSpin = spinView as Spin; if(newSpin) { Tizen.Log.Debug("NUI", "Downcast to Spin successful: newSpin Name = " + newSpin.Name + ", MaxValue = " + newSpin.MaxValue); @@ -845,7 +845,7 @@ namespace DaliTest View mySpinView = container.FindChildByName("MySpinName"); if(mySpinView) { - MySpin newSpin = View.DownCast(mySpinView); + MySpin newSpin = mySpinView as MySpin; if(newSpin) { Tizen.Log.Debug("NUI", "Downcast to MySpin successful: newSpin Name = " + newSpin.Name + ", MyOwnName = " + newSpin.MyOwnName + ", MaxValue = " + newSpin.MaxValue + ", currentValue = " + newSpin._myCurrentValue); @@ -875,8 +875,7 @@ namespace DaliTest for (uint i = 0; i < parent.ChildCount; i++) { - View child = parent.GetChildAt(i); - View childView = View.DownCast(child); + View childView = parent.GetChildAt(i); if (childView) { Tizen.Log.Debug("NUI", "Type[" + childView.GetTypeName() + "] BGColor[" + childView.BackgroundColor.R + "]" + " Name[" + childView.Name + "]"); diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/date-picker-using-json/date-picker-using-json.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/date-picker-using-json/date-picker-using-json.cs index 5e854e5..dd26180 100644 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/date-picker-using-json/date-picker-using-json.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/date-picker-using-json/date-picker-using-json.cs @@ -72,9 +72,9 @@ namespace DatePickerUsingJson View day = actorTree.FindChildByName("Day"); // need to get the actual C# Spin object associated with the actor, - _spinYear = View.DownCast( year ); - _spinMonth = View.DownCast( month ); - _spinDay = View.DownCast( day ); + _spinYear = year as Spin; + _spinMonth = month as Spin; + _spinDay = day as Spin; _spinYear.Value = 2099; _spinMonth.Value = 5; diff --git a/src/Tizen.NUI/src/internal/AccessibilityManager.cs b/src/Tizen.NUI/src/internal/AccessibilityManager.cs index f2a9ed3..4fe8cd2 100755 --- a/src/Tizen.NUI/src/internal/AccessibilityManager.cs +++ b/src/Tizen.NUI/src/internal/AccessibilityManager.cs @@ -2202,8 +2202,8 @@ namespace Tizen.NUI FocusChangedEventArgs e = new FocusChangedEventArgs(); // Populate all members of "e" (FocusChangedEventArgs) with real data - e.ViewCurrent = View.GetViewFromPtr(view1); - e.ViewNext = View.GetViewFromPtr(view2); + e.ViewCurrent = Registry.GetManagedBaseHandleFromNativePtr(view1) as View; + e.ViewNext = Registry.GetManagedBaseHandleFromNativePtr(view2) as View; if (_accessibilityManagerFocusChangedEventHandler != null) { @@ -2249,7 +2249,7 @@ namespace Tizen.NUI FocusedViewActivatedEventArgs e = new FocusedViewActivatedEventArgs(); // Populate all members of "e" (FocusedViewActivatedEventArgs) with real data - e.View = View.GetViewFromPtr(view); + e.View = Registry.GetManagedBaseHandleFromNativePtr(view) as View; if (_accessibilityManagerFocusedViewActivatedEventHandler != null) { @@ -2296,7 +2296,7 @@ namespace Tizen.NUI FocusOvershotEventArgs e = new FocusOvershotEventArgs(); // Populate all members of "e" (FocusOvershotEventArgs) with real data - e.CurrentFocusedView = View.GetViewFromPtr(currentFocusedView); + e.CurrentFocusedView = Registry.GetManagedBaseHandleFromNativePtr(currentFocusedView) as View; e.FocusOvershotDirection = direction; if (_accessibilityManagerFocusOvershotEventHandler != null) diff --git a/src/Tizen.NUI/src/internal/Alignment.cs b/src/Tizen.NUI/src/internal/Alignment.cs index d1e588b..e43fe34 100755 --- a/src/Tizen.NUI/src/internal/Alignment.cs +++ b/src/Tizen.NUI/src/internal/Alignment.cs @@ -64,9 +64,6 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/internal/CustomAlgorithmInterface.cs b/src/Tizen.NUI/src/internal/CustomAlgorithmInterface.cs index 9ff7657..5733df1 100755 --- a/src/Tizen.NUI/src/internal/CustomAlgorithmInterface.cs +++ b/src/Tizen.NUI/src/internal/CustomAlgorithmInterface.cs @@ -137,7 +137,10 @@ namespace Tizen.NUI private global::System.IntPtr SwigDirectorGetNextFocusableView(global::System.IntPtr current, global::System.IntPtr proposed, int direction) { - return View.getCPtr(GetNextFocusableView(new View(current, true), new View(proposed, true), (View.FocusDirection)direction)).Handle; + View currentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View; + View proposedView = Registry.GetManagedBaseHandleFromNativePtr(proposed) as View; + + return View.getCPtr(GetNextFocusableView(currentView, proposedView, (View.FocusDirection)direction)).Handle; } internal delegate global::System.IntPtr SwigDelegateCustomAlgorithmInterface_0(global::System.IntPtr current, global::System.IntPtr proposed, int direction); diff --git a/src/Tizen.NUI/src/internal/GaussianBlurView.cs b/src/Tizen.NUI/src/internal/GaussianBlurView.cs index 180eb91..4bde8c3 100755 --- a/src/Tizen.NUI/src/internal/GaussianBlurView.cs +++ b/src/Tizen.NUI/src/internal/GaussianBlurView.cs @@ -68,9 +68,6 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -145,7 +142,7 @@ namespace Tizen.NUI FinishedEventArgs e = new FinishedEventArgs(); // Populate all members of "e" (FinishedEventArgs) with real data - e.GaussianBlurView = GaussianBlurView.GetGaussianBlurViewFromPtr(data); + e.GaussianBlurView = Registry.GetManagedBaseHandleFromNativePtr(data) as GaussianBlurView; if (_gaussianFinishedEventHandler != null) { @@ -154,14 +151,6 @@ namespace Tizen.NUI } } - public static GaussianBlurView GetGaussianBlurViewFromPtr(global::System.IntPtr cPtr) - { - GaussianBlurView ret = new GaussianBlurView(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - public GaussianBlurView() : this(NDalicPINVOKE.GaussianBlurView_New__SWIG_0(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); diff --git a/src/Tizen.NUI/src/internal/ItemView.cs b/src/Tizen.NUI/src/internal/ItemView.cs index 15d9bc6..ae97da1 100755 --- a/src/Tizen.NUI/src/internal/ItemView.cs +++ b/src/Tizen.NUI/src/internal/ItemView.cs @@ -66,9 +66,6 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/internal/LongPressGestureDetector.cs b/src/Tizen.NUI/src/internal/LongPressGestureDetector.cs index 4977c03..bb41a9d 100755 --- a/src/Tizen.NUI/src/internal/LongPressGestureDetector.cs +++ b/src/Tizen.NUI/src/internal/LongPressGestureDetector.cs @@ -150,7 +150,7 @@ namespace Tizen.NUI DetectedEventArgs e = new DetectedEventArgs(); // Populate all members of "e" (LongPressGestureEventArgs) with real data - e.View = View.GetViewFromPtr(actor); + e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View; e.LongPressGesture = Tizen.NUI.LongPressGesture.GetLongPressGestureFromPtr(longPressGesture); if (_longPressGestureEventHandler != null) diff --git a/src/Tizen.NUI/src/internal/Model3dView.cs b/src/Tizen.NUI/src/internal/Model3dView.cs index 7f1b0fb..7c66870 100755 --- a/src/Tizen.NUI/src/internal/Model3dView.cs +++ b/src/Tizen.NUI/src/internal/Model3dView.cs @@ -64,9 +64,6 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs index 7cff7dd..9f3e342 100755 --- a/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs @@ -10904,6 +10904,10 @@ class NDalicPINVOKE { [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ViewResourceReadySignal")] public static extern void delete_ViewResourceReadySignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetRefObjectPtr")] + public static extern global::System.IntPtr GetRefObjectPtr(global::System.IntPtr jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseObject_SWIGUpcast")] public static extern global::System.IntPtr BaseObject_SWIGUpcast(global::System.IntPtr jarg1); diff --git a/src/Tizen.NUI/src/internal/PageTurnLandscapeView.cs b/src/Tizen.NUI/src/internal/PageTurnLandscapeView.cs index 5ca22ec..e9baf50 100755 --- a/src/Tizen.NUI/src/internal/PageTurnLandscapeView.cs +++ b/src/Tizen.NUI/src/internal/PageTurnLandscapeView.cs @@ -60,9 +60,6 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/internal/PageTurnPortraitView.cs b/src/Tizen.NUI/src/internal/PageTurnPortraitView.cs index 11b6d07..1d728a4 100755 --- a/src/Tizen.NUI/src/internal/PageTurnPortraitView.cs +++ b/src/Tizen.NUI/src/internal/PageTurnPortraitView.cs @@ -60,9 +60,6 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/internal/PageTurnView.cs b/src/Tizen.NUI/src/internal/PageTurnView.cs index 6f2b240..61cbfd1 100755 --- a/src/Tizen.NUI/src/internal/PageTurnView.cs +++ b/src/Tizen.NUI/src/internal/PageTurnView.cs @@ -50,9 +50,6 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/internal/PanGestureDetector.cs b/src/Tizen.NUI/src/internal/PanGestureDetector.cs index 0b0857d..79dd80a 100755 --- a/src/Tizen.NUI/src/internal/PanGestureDetector.cs +++ b/src/Tizen.NUI/src/internal/PanGestureDetector.cs @@ -152,7 +152,7 @@ namespace Tizen.NUI DetectedEventArgs e = new DetectedEventArgs(); // Populate all members of "e" (PanGestureEventArgs) with real data - e.View = View.GetViewFromPtr(actor); + e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View; e.PanGesture = Tizen.NUI.PanGesture.GetPanGestureFromPtr(panGesture); if (_panGestureEventHandler != null) diff --git a/src/Tizen.NUI/src/internal/PinchGestureDetector.cs b/src/Tizen.NUI/src/internal/PinchGestureDetector.cs index fc81c72..c6ecd48 100755 --- a/src/Tizen.NUI/src/internal/PinchGestureDetector.cs +++ b/src/Tizen.NUI/src/internal/PinchGestureDetector.cs @@ -153,7 +153,7 @@ namespace Tizen.NUI DetectedEventArgs e = new DetectedEventArgs(); // Populate all members of "e" (DetectedEventArgs) with real data - e.View = View.GetViewFromPtr(actor); + e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View; e.PinchGesture = Tizen.NUI.PinchGesture.GetPinchGestureFromPtr(pinchGesture); if (_pinchGestureEventHandler != null) diff --git a/src/Tizen.NUI/src/internal/Registry.cs b/src/Tizen.NUI/src/internal/Registry.cs index ffb9c78..c7a3597 100755 --- a/src/Tizen.NUI/src/internal/Registry.cs +++ b/src/Tizen.NUI/src/internal/Registry.cs @@ -85,28 +85,26 @@ namespace Tizen.NUI internal static BaseHandle GetManagedBaseHandleFromNativePtr(BaseHandle baseHandle) { - // we store a dictionary of ref-obects (C++ land) to managed obects (C# land) - RefObject refObj = baseHandle.GetObjectPtr(); IntPtr refObjectPtr = (IntPtr)RefObject.getCPtr(refObj); - WeakReference viewReference; - if (Instance._controlMap.TryGetValue(refObjectPtr, out viewReference)) - { - BaseHandle ret = viewReference.Target as BaseHandle; - return ret; - } - else - { - return null; - } + // we store a dictionary of ref-obects (C++ land) to managed obects (C# land) + return GetManagedBaseHandleFromRefObject(refObjectPtr); } - internal static BaseHandle GetManagedBaseHandleFromRefObject(IntPtr refObjectPtr) + internal static BaseHandle GetManagedBaseHandleFromNativePtr(IntPtr cPtr) { + IntPtr refObjectPtr = NDalicPINVOKE.GetRefObjectPtr(cPtr); + // we store a dictionary of ref-obects (C++ land) to managed obects (C# land) + return GetManagedBaseHandleFromRefObject(refObjectPtr); + } + internal static BaseHandle GetManagedBaseHandleFromRefObject(IntPtr refObjectPtr) + { + // we store a dictionary of ref-obects (C++ land) to managed obects (C# land) WeakReference weakReference; + if (Instance._controlMap.TryGetValue(refObjectPtr, out weakReference)) { BaseHandle ret = weakReference.Target as BaseHandle; diff --git a/src/Tizen.NUI/src/internal/Slider.cs b/src/Tizen.NUI/src/internal/Slider.cs index e7fcdd1..fad752c 100755 --- a/src/Tizen.NUI/src/internal/Slider.cs +++ b/src/Tizen.NUI/src/internal/Slider.cs @@ -72,9 +72,6 @@ namespace Tizen.NUI.UIComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/internal/TapGestureDetector.cs b/src/Tizen.NUI/src/internal/TapGestureDetector.cs index ded1004..cd52f2a 100755 --- a/src/Tizen.NUI/src/internal/TapGestureDetector.cs +++ b/src/Tizen.NUI/src/internal/TapGestureDetector.cs @@ -150,7 +150,7 @@ namespace Tizen.NUI DetectedEventArgs e = new DetectedEventArgs(); // Populate all members of "e" (DetectedEventArgs) with real data - e.View = View.GetViewFromPtr(actor); + e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View; e.TapGesture = Tizen.NUI.TapGesture.GetTapGestureFromPtr(tapGesture); if (_tapGestureEventHandler != null) diff --git a/src/Tizen.NUI/src/public/AlphaFunction.cs b/src/Tizen.NUI/src/public/AlphaFunction.cs index 834d163..ed35633 100755 --- a/src/Tizen.NUI/src/public/AlphaFunction.cs +++ b/src/Tizen.NUI/src/public/AlphaFunction.cs @@ -40,8 +40,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/Animation.cs b/src/Tizen.NUI/src/public/Animation.cs index 42c553c..d999316 100755 --- a/src/Tizen.NUI/src/public/Animation.cs +++ b/src/Tizen.NUI/src/public/Animation.cs @@ -201,13 +201,6 @@ namespace Tizen.NUI } } - internal static Animation GetAnimationFromPtr(global::System.IntPtr cPtr) - { - Animation ret = new Animation(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - private float MilliSecondsToSeconds(int millisec) { return (float)millisec / 1000.0f; diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index 7152e60..ce3a7d4 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -113,7 +113,7 @@ namespace Tizen.NUI.BaseComponents ResourceReadyEventArgs e = new ResourceReadyEventArgs(); if(data != null) { - e.View = View.GetViewFromPtr(data); + e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View; } if (_resourceReadyEventHandler != null) @@ -191,19 +191,6 @@ namespace Tizen.NUI.BaseComponents } /// - /// Downcasts a handle to ImageView handle.
- /// If handle points to a ImageView, the downcast produces valid handle.
- /// If not, the returned handle is left uninitialized.
- ///
- /// Handle to an object - /// Handle to a ImageView or an uninitialized handle - internal new static ImageView DownCast(BaseHandle handle) - { - ImageView ret = new ImageView(NDalicPINVOKE.ImageView_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - /// /// Sets this ImageView from the given URL.
/// If the URL is empty, ImageView will not display anything.
///
diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs index 26fd4c2..366d821 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -141,7 +141,7 @@ namespace Tizen.NUI.BaseComponents TextChangedEventArgs e = new TextChangedEventArgs(); // Populate all members of "e" (TextChangedEventArgs) with real data - e.TextEditor = TextEditor.GetTextEditorFromPtr(textEditor); + e.TextEditor = Registry.GetManagedBaseHandleFromNativePtr(textEditor) as TextEditor; if (_textEditorTextChangedEventHandler != null) { @@ -227,7 +227,7 @@ namespace Tizen.NUI.BaseComponents if (textEditor != null) { // Populate all members of "e" (ScrollStateChangedEventArgs) with real data - e.TextEditor = TextEditor.GetTextEditorFromPtr(textEditor); + e.TextEditor = Registry.GetManagedBaseHandleFromNativePtr(textEditor) as TextEditor; e.ScrollState = state; } @@ -238,14 +238,6 @@ namespace Tizen.NUI.BaseComponents } } - internal static TextEditor GetTextEditorFromPtr(global::System.IntPtr cPtr) - { - TextEditor ret = new TextEditor(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - internal class Property { internal static readonly int RENDERING_BACKEND = NDalicPINVOKE.TextEditor_Property_RENDERING_BACKEND_get(); @@ -330,18 +322,6 @@ namespace Tizen.NUI.BaseComponents if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - /// - /// Downcasts a handle to TextEditor. - /// - /// Handle to an object - /// Handle to a TextEditor or an empty handle - internal new static TextEditor DownCast(BaseHandle handle) - { - TextEditor ret = new TextEditor(NDalicPINVOKE.TextEditor_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - internal TextEditorSignal TextChangedSignal() { TextEditorSignal ret = new TextEditorSignal(NDalicPINVOKE.TextEditor_TextChangedSignal(swigCPtr), false); diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs index db3c3e7..c898ac8 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs @@ -170,7 +170,7 @@ namespace Tizen.NUI.BaseComponents TextChangedEventArgs e = new TextChangedEventArgs(); // Populate all members of "e" (TextChangedEventArgs) with real data - e.TextField = TextField.GetTextFieldFromPtr(textField); + e.TextField = Registry.GetManagedBaseHandleFromNativePtr(textField) as TextField; if (_textFieldTextChangedEventHandler != null) { @@ -209,7 +209,7 @@ namespace Tizen.NUI.BaseComponents MaxLengthReachedEventArgs e = new MaxLengthReachedEventArgs(); // Populate all members of "e" (MaxLengthReachedEventArgs) with real data - e.TextField = TextField.GetTextFieldFromPtr(textField); + e.TextField = Registry.GetManagedBaseHandleFromNativePtr(textField) as TextField; if (_textFieldMaxLengthReachedEventHandler != null) { @@ -219,14 +219,6 @@ namespace Tizen.NUI.BaseComponents } - internal static TextField GetTextFieldFromPtr(global::System.IntPtr cPtr) - { - TextField ret = new TextField(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - internal class Property { internal static readonly int RENDERING_BACKEND = NDalicPINVOKE.TextField_Property_RENDERING_BACKEND_get(); @@ -311,18 +303,6 @@ namespace Tizen.NUI.BaseComponents if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - /// - /// Downcasts a handle to TextField. - /// - /// Handle to an object - /// Handle to a TextField or an empty handle - internal new static TextField DownCast(BaseHandle handle) - { - TextField ret = new TextField(NDalicPINVOKE.TextField_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - internal TextFieldSignal TextChangedSignal() { TextFieldSignal ret = new TextFieldSignal(NDalicPINVOKE.TextField_TextChangedSignal(swigCPtr), false); diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs index 0ebbfe1..10d6acb 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -137,18 +137,6 @@ namespace Tizen.NUI.BaseComponents if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - - /// - /// Downcasts a handle to TextLabel. - /// - /// Handle to an object - internal new static TextLabel DownCast(BaseHandle handle) - { - TextLabel ret = new TextLabel(NDalicPINVOKE.TextLabel_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - /// /// Text property.
/// The text to display in UTF-8 format.
diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 80b3a38..698d0d2 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -30,9 +30,6 @@ namespace Tizen.NUI.BaseComponents internal View(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.View_SWIGUpcast(cPtr), cMemoryOwn) { swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); - - // Register this instance of view in the registry. - Registry.Register(this); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj) @@ -59,9 +56,6 @@ namespace Tizen.NUI.BaseComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -666,7 +660,7 @@ namespace Tizen.NUI.BaseComponents VisibilityChangedEventArgs e = new VisibilityChangedEventArgs(); if (data != null) { - e.View = View.GetViewFromPtr(data); + e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View; } e.Visibility = visibility; e.Type = type; @@ -720,14 +714,6 @@ namespace Tizen.NUI.BaseComponents } } - - internal static View GetViewFromPtr(global::System.IntPtr cPtr) - { - View ret = new View(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - internal IntPtr GetPtrfromView() { return (IntPtr)swigCPtr; @@ -838,22 +824,6 @@ namespace Tizen.NUI.BaseComponents return ret; } - /// - /// Downcasts a handle to class which inherit View handle. - /// - /// Class which inherit View - /// View to an object - /// A object which inherit View - public static T DownCast(View view) where T : View - { - View ret = Registry.GetManagedBaseHandleFromNativePtr(view) as View; - if (ret != null) - { - return (T)ret; - } - return null; - } - private View ConvertIdToView(uint id) { View view = null; @@ -2088,17 +2058,12 @@ namespace Tizen.NUI.BaseComponents public View GetChildAt(uint index) { IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index); - cPtr = NDalicPINVOKE.View_SWIGUpcast(cPtr); - cPtr = NDalicPINVOKE.Handle_SWIGUpcast(cPtr); - BaseHandle ret = new BaseHandle(cPtr, false); - - View temp = Registry.GetManagedBaseHandleFromNativePtr(ret) as View; + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - - return temp ?? null; + return ret ?? null; } /// @@ -2110,7 +2075,10 @@ namespace Tizen.NUI.BaseComponents /// A handle to the view if found, or an empty handle if not public View FindChildByName(string viewName) { - View ret = new View(NDalicPINVOKE.Actor_FindChildByName(swigCPtr, viewName), true); + IntPtr cPtr = NDalicPINVOKE.Actor_FindChildByName(swigCPtr, viewName); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -2118,7 +2086,10 @@ namespace Tizen.NUI.BaseComponents internal View FindChildById(uint id) { - View ret = new View(NDalicPINVOKE.Actor_FindChildById(swigCPtr, id), true); + IntPtr cPtr = NDalicPINVOKE.Actor_FindChildById(swigCPtr, id); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; @@ -2126,7 +2097,10 @@ namespace Tizen.NUI.BaseComponents internal View GetParent() { - View ret = new View(NDalicPINVOKE.Actor_GetParent(swigCPtr), true); + IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; diff --git a/src/Tizen.NUI/src/public/BaseHandle.cs b/src/Tizen.NUI/src/public/BaseHandle.cs index ce7dc6e..a59453e 100755 --- a/src/Tizen.NUI/src/public/BaseHandle.cs +++ b/src/Tizen.NUI/src/public/BaseHandle.cs @@ -20,6 +20,9 @@ namespace Tizen.NUI { swigCMemOwn = cMemoryOwn; swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + + // Register this instance of BaseHandle in the registry. + Registry.Register(this); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(BaseHandle obj) @@ -79,6 +82,9 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. + //Unreference this instance from Registry. + Registry.Unregister(this); + if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) diff --git a/src/Tizen.NUI/src/public/Color.cs b/src/Tizen.NUI/src/public/Color.cs index 505feb6..e943d8c 100755 --- a/src/Tizen.NUI/src/public/Color.cs +++ b/src/Tizen.NUI/src/public/Color.cs @@ -40,8 +40,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/Degree.cs b/src/Tizen.NUI/src/public/Degree.cs index fcebba7..6e7e6d8 100755 --- a/src/Tizen.NUI/src/public/Degree.cs +++ b/src/Tizen.NUI/src/public/Degree.cs @@ -31,13 +31,11 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. protected bool disposed = false; - + ~Degree() { if(!isDisposeQueued) diff --git a/src/Tizen.NUI/src/public/FlexContainer.cs b/src/Tizen.NUI/src/public/FlexContainer.cs index 0e598d6..e82bc4c 100755 --- a/src/Tizen.NUI/src/public/FlexContainer.cs +++ b/src/Tizen.NUI/src/public/FlexContainer.cs @@ -113,13 +113,6 @@ namespace Tizen.NUI } - internal new static FlexContainer DownCast(BaseHandle handle) - { - FlexContainer ret = new FlexContainer(NDalicPINVOKE.FlexContainer_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - /// /// Enumeration for the direction of the main axis in the flex container. This determines /// the direction that flex items are laid out in the flex container. diff --git a/src/Tizen.NUI/src/public/FocusManager.cs b/src/Tizen.NUI/src/public/FocusManager.cs index 4ebae95..29e937d 100755 --- a/src/Tizen.NUI/src/public/FocusManager.cs +++ b/src/Tizen.NUI/src/public/FocusManager.cs @@ -181,11 +181,11 @@ namespace Tizen.NUI if (current != global::System.IntPtr.Zero) { - e.CurrentView = View.GetViewFromPtr(current); + e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View; } if (proposed != global::System.IntPtr.Zero) { - e.ProposedView = View.GetViewFromPtr(proposed); + e.ProposedView = Registry.GetManagedBaseHandleFromNativePtr(proposed) as View; } e.Direction = direction; @@ -273,8 +273,8 @@ namespace Tizen.NUI { FocusChangedEventArgs e = new FocusChangedEventArgs(); - e.CurrentView = View.GetViewFromPtr(current); - e.NextView = View.GetViewFromPtr(next); + e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View; + e.NextView = Registry.GetManagedBaseHandleFromNativePtr(next) as View; if (_focusChangedEventHandler != null) { @@ -351,7 +351,7 @@ namespace Tizen.NUI { FocusGroupChangedEventArgs e = new FocusGroupChangedEventArgs(); - e.CurrentView = View.GetViewFromPtr(current); + e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View; e.ForwardDirection = forwardDirection; if (_focusGroupChangedEventHandler != null) @@ -414,7 +414,7 @@ namespace Tizen.NUI { FocusedViewActivatedEventArgs e = new FocusedViewActivatedEventArgs(); - e.View = View.GetViewFromPtr(view); + e.View = Registry.GetManagedBaseHandleFromNativePtr(view) as View; if (_focusedViewEnterKeyEventHandler != null) { @@ -455,12 +455,9 @@ namespace Tizen.NUI /// A handle to the current focused View or an empty handle if no View is focused public View GetCurrentFocusView() { - View ret = new View(NDalicManualPINVOKE.FocusManager_GetCurrentFocusActor(swigCPtr), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - if (ret.HasBody() == false) - { - return null; - } + IntPtr cPtr = NDalicManualPINVOKE.FocusManager_GetCurrentFocusActor(swigCPtr); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; return ret; } @@ -555,12 +552,18 @@ namespace Tizen.NUI /// The focus group the given view belongs to or an empty handle if the given view public View GetFocusGroup(View view) { - View ret = new View(NDalicManualPINVOKE.FocusManager_GetFocusGroup(swigCPtr, View.getCPtr(view)), true); + IntPtr cPtr = NDalicManualPINVOKE.FocusManager_GetFocusGroup(swigCPtr, View.getCPtr(view)); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + + /*View ret = new View(NDalicManualPINVOKE.FocusManager_GetFocusGroup(swigCPtr, View.getCPtr(view)), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); if (ret.HasBody() == false) { return null; - } + }*/ + return ret; } @@ -588,12 +591,10 @@ namespace Tizen.NUI internal View GetFocusIndicatorView() { - View ret = new View(NDalicManualPINVOKE.FocusManager_GetFocusIndicatorActor(swigCPtr), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - if (ret.HasBody() == false) - { - return null; - } + IntPtr cPtr = NDalicManualPINVOKE.FocusManager_GetFocusIndicatorActor(swigCPtr); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + return ret; } @@ -678,9 +679,7 @@ namespace Tizen.NUI public override View GetNextFocusableView(View current, View proposed, View.FocusDirection direction) { - View currentView = View.DownCast(current); - View proposedView = View.DownCast(proposed); - return _customFocusAlgorithm.GetNextFocusableView(currentView, proposedView, direction); + return _customFocusAlgorithm.GetNextFocusableView(current, proposed, direction); } } } diff --git a/src/Tizen.NUI/src/public/Geometry.cs b/src/Tizen.NUI/src/public/Geometry.cs index a4430b5..999a162 100755 --- a/src/Tizen.NUI/src/public/Geometry.cs +++ b/src/Tizen.NUI/src/public/Geometry.cs @@ -79,13 +79,6 @@ namespace Tizen.NUI } - internal static Geometry DownCast(BaseHandle handle) - { - Geometry ret = new Geometry(NDalicPINVOKE.Geometry_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - public uint AddVertexBuffer(PropertyBuffer vertexBuffer) { uint ret = NDalicPINVOKE.Geometry_AddVertexBuffer(swigCPtr, PropertyBuffer.getCPtr(vertexBuffer)); diff --git a/src/Tizen.NUI/src/public/Gesture.cs b/src/Tizen.NUI/src/public/Gesture.cs index 7a5c1a8..4a337f3 100755 --- a/src/Tizen.NUI/src/public/Gesture.cs +++ b/src/Tizen.NUI/src/public/Gesture.cs @@ -32,8 +32,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/Hover.cs b/src/Tizen.NUI/src/public/Hover.cs index dfd6d92..a67db81 100755 --- a/src/Tizen.NUI/src/public/Hover.cs +++ b/src/Tizen.NUI/src/public/Hover.cs @@ -32,8 +32,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/Key.cs b/src/Tizen.NUI/src/public/Key.cs index 4c00e12..66cc141 100755 --- a/src/Tizen.NUI/src/public/Key.cs +++ b/src/Tizen.NUI/src/public/Key.cs @@ -30,8 +30,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/KeyFrames.cs b/src/Tizen.NUI/src/public/KeyFrames.cs index 225157f..6be6ed4 100755 --- a/src/Tizen.NUI/src/public/KeyFrames.cs +++ b/src/Tizen.NUI/src/public/KeyFrames.cs @@ -109,19 +109,6 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - /// - /// Downcasts a handle to KeyFrames handle.
- /// If handle points to a KeyFrames object, the downcast produces valid handle.
- /// If not, the returned handle is left uninitialized.
- ///
- /// Handle to an object - /// Handle to a KeyFrames object or an uninitialized handle - internal static KeyFrames DownCast(BaseHandle handle) - { - KeyFrames ret = new KeyFrames(NDalicPINVOKE.KeyFrames_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } /// /// Gets the type of the key frame. diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs index d7ffb21..b9ab260 100755 --- a/src/Tizen.NUI/src/public/Layer.cs +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -80,19 +80,6 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - /// - /// Downcasts a handle to Layer handle.
- /// If handle points to a Layer, the downcast produces valid handle.
- /// If not, the returned handle is left uninitialized.
- ///
- /// Handle to an object - /// Handle to a Layer or an uninitialized handle - internal new static Layer DownCast(BaseHandle handle) - { - Layer ret = new Layer(NDalicPINVOKE.Layer_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } /// /// Search through this layer's hierarchy for an view with the given unique ID. @@ -278,17 +265,13 @@ namespace Tizen.NUI public View GetChildAt(uint index) { System.IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index); - cPtr = NDalicPINVOKE.View_SWIGUpcast(cPtr); - cPtr = NDalicPINVOKE.Handle_SWIGUpcast(cPtr); - - BaseHandle ret = new BaseHandle(cPtr, false); - View temp = Registry.GetManagedBaseHandleFromNativePtr(ret) as View; + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return temp ?? null; + return ret ?? null; } /// diff --git a/src/Tizen.NUI/src/public/Position.cs b/src/Tizen.NUI/src/public/Position.cs index 60da1e5..cff3f9b 100755 --- a/src/Tizen.NUI/src/public/Position.cs +++ b/src/Tizen.NUI/src/public/Position.cs @@ -37,8 +37,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/Position2D.cs b/src/Tizen.NUI/src/public/Position2D.cs index c376ead..c773814 100755 --- a/src/Tizen.NUI/src/public/Position2D.cs +++ b/src/Tizen.NUI/src/public/Position2D.cs @@ -37,8 +37,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/ProgressBar.cs b/src/Tizen.NUI/src/public/ProgressBar.cs index e2dfec4..913f913 100755 --- a/src/Tizen.NUI/src/public/ProgressBar.cs +++ b/src/Tizen.NUI/src/public/ProgressBar.cs @@ -72,9 +72,6 @@ namespace Tizen.NUI.UIComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -171,7 +168,7 @@ namespace Tizen.NUI.UIComponents ValueChangedEventArgs e = new ValueChangedEventArgs(); // Populate all members of "e" (ValueChangedEventArgs) with real page - e.ProgressBar = ProgressBar.GetProgressBarFromPtr(progressBar); + e.ProgressBar = Registry.GetManagedBaseHandleFromNativePtr(progressBar) as ProgressBar; e.ProgressValue = progressValue; e.SecondaryProgressValue = secondaryProgressValue; @@ -181,15 +178,6 @@ namespace Tizen.NUI.UIComponents } } - /// - /// - internal static ProgressBar GetProgressBarFromPtr(global::System.IntPtr cPtr) - { - ProgressBar ret = new ProgressBar(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - internal class Property { internal static readonly int PROGRESS_VALUE = NDalicPINVOKE.ProgressBar_Property_PROGRESS_VALUE_get(); diff --git a/src/Tizen.NUI/src/public/Property.cs b/src/Tizen.NUI/src/public/Property.cs index 7f61663..a1b30a0 100755 --- a/src/Tizen.NUI/src/public/Property.cs +++ b/src/Tizen.NUI/src/public/Property.cs @@ -27,8 +27,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. @@ -239,8 +237,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. @@ -468,8 +464,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. @@ -707,8 +701,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. @@ -1006,8 +998,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/PropertyBuffer.cs b/src/Tizen.NUI/src/public/PropertyBuffer.cs index b661796..c87c606 100755 --- a/src/Tizen.NUI/src/public/PropertyBuffer.cs +++ b/src/Tizen.NUI/src/public/PropertyBuffer.cs @@ -80,13 +80,6 @@ namespace Tizen.NUI } - internal static PropertyBuffer DownCast(BaseHandle handle) - { - PropertyBuffer ret = new PropertyBuffer(NDalicPINVOKE.PropertyBuffer_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - public void SetData(System.IntPtr data, uint size) { NDalicPINVOKE.PropertyBuffer_SetData(swigCPtr, data, size); diff --git a/src/Tizen.NUI/src/public/Radian.cs b/src/Tizen.NUI/src/public/Radian.cs index 36de9bc..0ca1e88 100755 --- a/src/Tizen.NUI/src/public/Radian.cs +++ b/src/Tizen.NUI/src/public/Radian.cs @@ -30,8 +30,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/Rectangle.cs b/src/Tizen.NUI/src/public/Rectangle.cs index 95ae7ee..2229392 100755 --- a/src/Tizen.NUI/src/public/Rectangle.cs +++ b/src/Tizen.NUI/src/public/Rectangle.cs @@ -30,8 +30,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/RelativeVector2.cs b/src/Tizen.NUI/src/public/RelativeVector2.cs index f5052fa..de4f503 100755 --- a/src/Tizen.NUI/src/public/RelativeVector2.cs +++ b/src/Tizen.NUI/src/public/RelativeVector2.cs @@ -39,8 +39,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/RelativeVector3.cs b/src/Tizen.NUI/src/public/RelativeVector3.cs index 0aec4dc..d83d7b0 100755 --- a/src/Tizen.NUI/src/public/RelativeVector3.cs +++ b/src/Tizen.NUI/src/public/RelativeVector3.cs @@ -39,8 +39,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/RelativeVector4.cs b/src/Tizen.NUI/src/public/RelativeVector4.cs index 69cbdec..4ab3671 100755 --- a/src/Tizen.NUI/src/public/RelativeVector4.cs +++ b/src/Tizen.NUI/src/public/RelativeVector4.cs @@ -39,8 +39,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. @@ -244,7 +242,7 @@ namespace Tizen.NUI /// Constructor /// /// RelativeVector3 to create this vector from - public RelativeVector4(RelativeVector3 relativeVector3) : this(NDalicPINVOKE.new_Vector4__SWIG_4(RelativeVector3.getCPtr(relativeVector3)), true) + public RelativeVector4(RelativeVector3 relativeVector3) : this(NDalicPINVOKE.new_Vector4__SWIG_4(RelativeVector3.getCPtr(relativeVector3)), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } diff --git a/src/Tizen.NUI/src/public/RelayoutContainer.cs b/src/Tizen.NUI/src/public/RelayoutContainer.cs index 1b990a8..dae6cc8 100755 --- a/src/Tizen.NUI/src/public/RelayoutContainer.cs +++ b/src/Tizen.NUI/src/public/RelayoutContainer.cs @@ -39,8 +39,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/Renderer.cs b/src/Tizen.NUI/src/public/Renderer.cs index 6535767..b00223e 100755 --- a/src/Tizen.NUI/src/public/Renderer.cs +++ b/src/Tizen.NUI/src/public/Renderer.cs @@ -109,13 +109,6 @@ namespace Tizen.NUI } - internal new static Renderer DownCast(BaseHandle handle) - { - Renderer ret = new Renderer(NDalicPINVOKE.Renderer_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - public void SetGeometry(Geometry geometry) { NDalicPINVOKE.Renderer_SetGeometry(swigCPtr, Geometry.getCPtr(geometry)); diff --git a/src/Tizen.NUI/src/public/Rotation.cs b/src/Tizen.NUI/src/public/Rotation.cs index 70bd9e6..16131f5 100755 --- a/src/Tizen.NUI/src/public/Rotation.cs +++ b/src/Tizen.NUI/src/public/Rotation.cs @@ -30,8 +30,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/Sampler.cs b/src/Tizen.NUI/src/public/Sampler.cs index 2a5bfb2..039d730 100755 --- a/src/Tizen.NUI/src/public/Sampler.cs +++ b/src/Tizen.NUI/src/public/Sampler.cs @@ -81,13 +81,6 @@ namespace Tizen.NUI } - internal static Sampler DownCast(BaseHandle handle) - { - Sampler ret = new Sampler(NDalicPINVOKE.Sampler_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - public void SetFilterMode(FilterModeType minFilter, FilterModeType magFilter) { NDalicPINVOKE.Sampler_SetFilterMode(swigCPtr, (int)minFilter, (int)magFilter); diff --git a/src/Tizen.NUI/src/public/Scrollable.cs b/src/Tizen.NUI/src/public/Scrollable.cs index 9602bef..57e8a9d 100755 --- a/src/Tizen.NUI/src/public/Scrollable.cs +++ b/src/Tizen.NUI/src/public/Scrollable.cs @@ -50,9 +50,6 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -295,13 +292,6 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal new static Scrollable DownCast(BaseHandle handle) - { - Scrollable ret = new Scrollable(NDalicPINVOKE.Scrollable_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - private bool IsOvershootEnabled() { bool ret = NDalicPINVOKE.Scrollable_IsOvershootEnabled(swigCPtr); diff --git a/src/Tizen.NUI/src/public/Shader.cs b/src/Tizen.NUI/src/public/Shader.cs index aaccc8c..cf167f3 100755 --- a/src/Tizen.NUI/src/public/Shader.cs +++ b/src/Tizen.NUI/src/public/Shader.cs @@ -100,13 +100,6 @@ namespace Tizen.NUI } - internal new static Shader DownCast(BaseHandle handle) - { - Shader ret = new Shader(NDalicPINVOKE.Shader_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - public Tizen.NUI.PropertyMap Program { get diff --git a/src/Tizen.NUI/src/public/Size2D.cs b/src/Tizen.NUI/src/public/Size2D.cs index 82235c2..9e3b50c 100755 --- a/src/Tizen.NUI/src/public/Size2D.cs +++ b/src/Tizen.NUI/src/public/Size2D.cs @@ -37,8 +37,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/StyleManager.cs b/src/Tizen.NUI/src/public/StyleManager.cs index 8502ddc..1692f23 100755 --- a/src/Tizen.NUI/src/public/StyleManager.cs +++ b/src/Tizen.NUI/src/public/StyleManager.cs @@ -149,7 +149,7 @@ namespace Tizen.NUI StyleChangedEventArgs e = new StyleChangedEventArgs(); // Populate all members of "e" (StyleChangedEventArgs) with real data - e.StyleManager = StyleManager.GetStyleManagerFromPtr(styleManager); + e.StyleManager = Registry.GetManagedBaseHandleFromNativePtr(styleManager) as StyleManager; e.StyleChange = styleChange; if (_styleManagerStyleChangedEventHandler != null) @@ -159,13 +159,6 @@ namespace Tizen.NUI } } - internal static StyleManager GetStyleManagerFromPtr(global::System.IntPtr cPtr) - { - StyleManager ret = new StyleManager(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - /// /// Creates a StyleManager handle.
/// this can be initialized with StyleManager::Get().
diff --git a/src/Tizen.NUI/src/public/TableView.cs b/src/Tizen.NUI/src/public/TableView.cs index 01a94ea..28f5aad 100755 --- a/src/Tizen.NUI/src/public/TableView.cs +++ b/src/Tizen.NUI/src/public/TableView.cs @@ -120,8 +120,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. @@ -330,20 +328,6 @@ namespace Tizen.NUI } /// - /// Downcasts a handle to TableView handle.
- /// If handle points to a TableView, the downcast produces valid handle.
- /// If not, the returned handle is left uninitialized.
- ///
- /// Handle to an object - /// Handle to a TableView or an uninitialized handle - internal new static TableView DownCast(BaseHandle handle) - { - TableView ret = new TableView(NDalicPINVOKE.TableView_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// /// Adds a child to the table.
/// If the row or column index is outside the table, the table gets resized bigger.
///
diff --git a/src/Tizen.NUI/src/public/Texture.cs b/src/Tizen.NUI/src/public/Texture.cs index 7c857a3..5a52b03 100755 --- a/src/Tizen.NUI/src/public/Texture.cs +++ b/src/Tizen.NUI/src/public/Texture.cs @@ -85,13 +85,6 @@ namespace Tizen.NUI } - internal static Texture DownCast(BaseHandle handle) - { - Texture ret = new Texture(NDalicPINVOKE.Texture_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - public bool Upload(PixelData pixelData) { bool ret = NDalicPINVOKE.Texture_Upload__SWIG_0(swigCPtr, PixelData.getCPtr(pixelData)); diff --git a/src/Tizen.NUI/src/public/TextureSet.cs b/src/Tizen.NUI/src/public/TextureSet.cs index d43d490..12ba07e 100755 --- a/src/Tizen.NUI/src/public/TextureSet.cs +++ b/src/Tizen.NUI/src/public/TextureSet.cs @@ -80,13 +80,6 @@ namespace Tizen.NUI } - internal static TextureSet DownCast(BaseHandle handle) - { - TextureSet ret = new TextureSet(NDalicPINVOKE.TextureSet_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - public void SetTexture(uint index, Texture texture) { NDalicPINVOKE.TextureSet_SetTexture(swigCPtr, index, Texture.getCPtr(texture)); diff --git a/src/Tizen.NUI/src/public/Timer.cs b/src/Tizen.NUI/src/public/Timer.cs index 44447cd..3b0dbe2 100755 --- a/src/Tizen.NUI/src/public/Timer.cs +++ b/src/Tizen.NUI/src/public/Timer.cs @@ -152,18 +152,6 @@ namespace Tizen.NUI } /// - /// Downcasts a handle to Timer handle. - /// - /// handle to An object - /// handle to a Timer object or an uninitialized handle - internal static Timer DownCast(BaseHandle handle) - { - Timer ret = new Timer(NDalicPINVOKE.Timer_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// /// Starts timer.
/// In case a Timer is already running, its time is reset and timer is restarted.
///
diff --git a/src/Tizen.NUI/src/public/TransitionData.cs b/src/Tizen.NUI/src/public/TransitionData.cs index 0bbd686..265db8b 100755 --- a/src/Tizen.NUI/src/public/TransitionData.cs +++ b/src/Tizen.NUI/src/public/TransitionData.cs @@ -83,12 +83,6 @@ namespace Tizen.NUI if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - internal static TransitionData DownCast(BaseHandle handle) - { - TransitionData ret = new TransitionData(NDalicPINVOKE.TransitionData_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } public TransitionData(TransitionData handle) : this(NDalicPINVOKE.new_TransitionData__SWIG_1(TransitionData.getCPtr(handle)), true) { diff --git a/src/Tizen.NUI/src/public/UIComponents/Button.cs b/src/Tizen.NUI/src/public/UIComponents/Button.cs index 7df120d..4559b03 100755 --- a/src/Tizen.NUI/src/public/UIComponents/Button.cs +++ b/src/Tizen.NUI/src/public/UIComponents/Button.cs @@ -74,9 +74,6 @@ namespace Tizen.NUI.UIComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -262,14 +259,6 @@ namespace Tizen.NUI.UIComponents } - - internal static Button GetButtonFromPtr(global::System.IntPtr cPtr) - { - Button ret = new Button(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - /// /// Gets/Sets the unselected button foreground/icon visual /// @@ -535,20 +524,6 @@ namespace Tizen.NUI.UIComponents if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - /// - /// Downcasts a handle to Button handle.
- /// If handle points to a Button, the downcast produces valid handle.
- /// If not the returned handle is left uninitialized.
- ///
- /// Handle to an object - /// A handle to a Button or an uninitialized handle - internal new static Button DownCast(BaseHandle handle) - { - Button ret = new Button(NDalicPINVOKE.Button_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - internal ButtonSignal PressedSignal() { ButtonSignal ret = new ButtonSignal(NDalicPINVOKE.Button_PressedSignal(swigCPtr), false); diff --git a/src/Tizen.NUI/src/public/UIComponents/CheckBoxButton.cs b/src/Tizen.NUI/src/public/UIComponents/CheckBoxButton.cs index d8fe161..e2ef38a 100755 --- a/src/Tizen.NUI/src/public/UIComponents/CheckBoxButton.cs +++ b/src/Tizen.NUI/src/public/UIComponents/CheckBoxButton.cs @@ -61,7 +61,7 @@ namespace Tizen.NUI.UIComponents //Release your own unmanaged resources here. //You should not access any managed member here except static instance. - //because the execution order of Finalizes is non-deterministic. + //because the execution order of Finalizes is non-deterministic. if (swigCPtr.Handle != global::System.IntPtr.Zero) { @@ -85,13 +85,6 @@ namespace Tizen.NUI.UIComponents } - internal new static CheckBoxButton DownCast(BaseHandle handle) - { - CheckBoxButton ret = new CheckBoxButton(NDalicPINVOKE.CheckBoxButton_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - } } diff --git a/src/Tizen.NUI/src/public/UIComponents/Popup.cs b/src/Tizen.NUI/src/public/UIComponents/Popup.cs index 567eb80..72ad327 100755 --- a/src/Tizen.NUI/src/public/UIComponents/Popup.cs +++ b/src/Tizen.NUI/src/public/UIComponents/Popup.cs @@ -70,9 +70,6 @@ namespace Tizen.NUI.UIComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -365,20 +362,6 @@ namespace Tizen.NUI.UIComponents } /// - /// Downcasts a handle to Popup handle.
- /// If handle points to a Popup, the downcast produces valid handle.
- /// If not the returned handle is left uninitialized.
- ///
- /// Handle to an object - /// handle to a Popup or an uninitialized handle - public new static Popup DownCast(BaseHandle handle) - { - Popup ret = new Popup(NDalicPINVOKE.Popup_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// /// Sets a title for this Popup. /// /// The actor to set a title diff --git a/src/Tizen.NUI/src/public/UIComponents/PushButton.cs b/src/Tizen.NUI/src/public/UIComponents/PushButton.cs index c6ec224..d77feef 100755 --- a/src/Tizen.NUI/src/public/UIComponents/PushButton.cs +++ b/src/Tizen.NUI/src/public/UIComponents/PushButton.cs @@ -98,19 +98,5 @@ namespace Tizen.NUI.UIComponents if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - - /// - /// Downcasts a handle to PushButton handle.
- /// If handle points to a PushButton, the downcast produces valid handle.
- /// If not the returned handle is left uninitialized.
- ///
- /// Handle to an object - /// handle to a PushButton or an uninitialized handle - internal new static PushButton DownCast(BaseHandle handle) - { - PushButton ret = new PushButton(NDalicPINVOKE.PushButton_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } } } diff --git a/src/Tizen.NUI/src/public/UIComponents/RadioButton.cs b/src/Tizen.NUI/src/public/UIComponents/RadioButton.cs index f8816a9..dbb75ed 100755 --- a/src/Tizen.NUI/src/public/UIComponents/RadioButton.cs +++ b/src/Tizen.NUI/src/public/UIComponents/RadioButton.cs @@ -76,9 +76,6 @@ namespace Tizen.NUI.UIComponents //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -109,21 +106,5 @@ namespace Tizen.NUI.UIComponents if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - - /// - /// Downcasts a handle to RadioButton handle. - /// If handle points to a RadioButton, the downcast produces valid handle. - /// If not, the returned handle is left uninitialized. - /// - /// Handle to an object - /// A handle to a RadioButton or an uninitialized handle - internal new static RadioButton DownCast(BaseHandle handle) - { - RadioButton ret = new RadioButton(NDalicPINVOKE.RadioButton_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - } - } diff --git a/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs b/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs index 44a2fe0..828af76 100755 --- a/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs +++ b/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs @@ -234,20 +234,6 @@ namespace Tizen.NUI.UIComponents if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - /// - /// Downcasts a handle to ScrollBar handle.
- /// If handle points to a ScrollBar, the downcast produces valid handle.
- /// If not, the returned handle is left uninitialized.
- ///
- /// Handle to an object - /// Handle to a ScrollBar or an uninitialized handle - internal new static ScrollBar DownCast(BaseHandle handle) - { - ScrollBar ret = new ScrollBar(NDalicPINVOKE.ScrollBar_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - internal void SetScrollPropertySource(Animatable handle, int propertyScrollPosition, int propertyMinScrollPosition, int propertyMaxScrollPosition, int propertyScrollContentSize) { NDalicPINVOKE.ScrollBar_SetScrollPropertySource(swigCPtr, Animatable.getCPtr(handle), propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize); diff --git a/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs b/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs index 0846305..bcbae17 100755 --- a/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs +++ b/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs @@ -64,9 +64,6 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -342,13 +339,6 @@ namespace Tizen.NUI } - internal new static ScrollView DownCast(BaseHandle handle) - { - ScrollView ret = new ScrollView(NDalicPINVOKE.ScrollView_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - public AlphaFunction GetScrollSnapAlphaFunction() { AlphaFunction ret = new AlphaFunction(NDalicPINVOKE.ScrollView_GetScrollSnapAlphaFunction(swigCPtr), true); diff --git a/src/Tizen.NUI/src/public/UIComponents/ToggleButton.cs b/src/Tizen.NUI/src/public/UIComponents/ToggleButton.cs index 2ed083f..df17ca9 100755 --- a/src/Tizen.NUI/src/public/UIComponents/ToggleButton.cs +++ b/src/Tizen.NUI/src/public/UIComponents/ToggleButton.cs @@ -62,9 +62,6 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -91,13 +88,6 @@ namespace Tizen.NUI } - internal new static ToggleButton DownCast(BaseHandle handle) - { - ToggleButton ret = new ToggleButton(NDalicPINVOKE.ToggleButton_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - public Tizen.NUI.PropertyArray StateVisuals { get diff --git a/src/Tizen.NUI/src/public/Vector2.cs b/src/Tizen.NUI/src/public/Vector2.cs index fa80264..4c22296 100755 --- a/src/Tizen.NUI/src/public/Vector2.cs +++ b/src/Tizen.NUI/src/public/Vector2.cs @@ -30,8 +30,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/Vector3.cs b/src/Tizen.NUI/src/public/Vector3.cs index 4c54bd1..d54eddf 100755 --- a/src/Tizen.NUI/src/public/Vector3.cs +++ b/src/Tizen.NUI/src/public/Vector3.cs @@ -30,8 +30,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/Vector4.cs b/src/Tizen.NUI/src/public/Vector4.cs index d57ccd6..98d1a5e 100755 --- a/src/Tizen.NUI/src/public/Vector4.cs +++ b/src/Tizen.NUI/src/public/Vector4.cs @@ -30,8 +30,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. diff --git a/src/Tizen.NUI/src/public/VideoView.cs b/src/Tizen.NUI/src/public/VideoView.cs index af52689..a5363ca 100755 --- a/src/Tizen.NUI/src/public/VideoView.cs +++ b/src/Tizen.NUI/src/public/VideoView.cs @@ -143,7 +143,7 @@ namespace Tizen.NUI FinishedEventArgs e = new FinishedEventArgs(); // Populate all members of "e" (FinishedEventArgs) with real data - e.VideoView = VideoView.GetVideoViewFromPtr(data); + e.VideoView = Registry.GetManagedBaseHandleFromNativePtr(data) as VideoView; if (_videoViewFinishedEventHandler != null) { @@ -152,14 +152,6 @@ namespace Tizen.NUI } } - internal static VideoView GetVideoViewFromPtr(global::System.IntPtr cPtr) - { - VideoView ret = new VideoView(cPtr, false); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - internal class Property { internal static readonly int VIDEO = NDalicPINVOKE.VideoView_Property_VIDEO_get(); @@ -193,20 +185,6 @@ namespace Tizen.NUI } /// - /// Downcasts a handle to VideoView handle.
- /// If handle points to a VideoView, the downcast produces valid handle.
- /// If not, the returned handle is left uninitialized.
- ///
- /// Handle to an object - /// Handle to a VideoView or an uninitialized handle - internal new static VideoView DownCast(BaseHandle handle) - { - VideoView ret = new VideoView(NDalicPINVOKE.VideoView_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - - /// /// Starts the video playback. /// public void Play() diff --git a/src/Tizen.NUI/src/public/ViewWrapper.cs b/src/Tizen.NUI/src/public/ViewWrapper.cs index 087d503..deb1b85 100755 --- a/src/Tizen.NUI/src/public/ViewWrapper.cs +++ b/src/Tizen.NUI/src/public/ViewWrapper.cs @@ -55,9 +55,6 @@ namespace Tizen.NUI //You should not access any managed member here except static instance. //because the execution order of Finalizes is non-deterministic. - //Unreference this from if a static instance refer to this. - Registry.Unregister(this); - if (swigCPtr.Handle != global::System.IntPtr.Zero) { if (swigCMemOwn) @@ -77,12 +74,5 @@ namespace Tizen.NUI viewWrapperImpl = implementation; if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - - internal new static ViewWrapper DownCast(BaseHandle handle) - { - ViewWrapper ret = new ViewWrapper(NDalicManualPINVOKE.ViewWrapper_DownCast(BaseHandle.getCPtr(handle)), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } } } diff --git a/src/Tizen.NUI/src/public/Wheel.cs b/src/Tizen.NUI/src/public/Wheel.cs index 59bc7aa..e17f9a6 100755 --- a/src/Tizen.NUI/src/public/Wheel.cs +++ b/src/Tizen.NUI/src/public/Wheel.cs @@ -33,8 +33,6 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //NUI Dispose Pattern written by Jinwoo Nam(jjw.nam) - //A Flag to check who called Dispose(). (By User or DisposeQueue) private bool isDisposeQueued = false; //A Flat to check if it is already disposed. -- 2.7.4