<None Include="shared\res\NUISamples.TizenTV.png" />\r
</ItemGroup>\r
<ItemGroup>\r
+ <Compile Include="examples\as-is-test-sample.cs" />\r
<Compile Include="examples\control-dashboard.cs" />\r
<Compile Include="examples\custom-control.cs" />\r
<Compile Include="examples\dali-test.cs" />\r
//new VisualsUsingCustomView.VisualsExample().Run(args); //o
//new FirstScreen.FirstScreenApp().Run(args); //o
//new PositionUsesAnchorPointTest.Example().Run(args);
- new TizenVDUIApplication19.Program().Run(args);
+ // new VisualsExampleTest.Example().Run(args); //o
+ new TizenSTVUIApplication15.Program().Run(args);
}
}
}
--- /dev/null
+using System;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI;
+
+namespace TizenSTVUIApplication15
+{
+ class Program : NUIApplication
+ {
+ private Timer myTimer;
+
+ private View myView;
+ private TextLabel myTextLabel;
+
+
+ //===========================
+ Layer layer;
+ View vi1, vi2, vi3;
+ TextLabel tl1, tl2, tl3;
+ ToggleButton tb1, tb2, tb3;
+
+
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+
+ myView = new View();
+ myView.Size = new Size(100, 100, 0);
+ myView.Position = new Position(100, 100, 0);
+ myView.BackgroundColor = Color.Red;
+ myView.Name = "myView";
+
+ Window.Instance.GetDefaultLayer().Add(myView);
+
+ myTextLabel = new TextLabel();
+ myTextLabel.Position = new Position(100, 100, 0);
+ myTextLabel.Size = new Size(100, 100, 0);
+ myTextLabel.Name = "myTextLabel";
+
+ myView.Add(myTextLabel);
+
+ //===========================
+ LayerTest2();
+
+ myTimer = new Timer(500);
+ myTimer.Tick += Mytimer_Tick;
+ myTimer.Start();
+ }
+
+ private void ObjectDumpTrigger()
+ {
+ for (int i = 0; i < Window.GetLayerCount(); i++)
+ {
+ BFS(Window.GetLayer((uint)i), 1);
+ }
+ }
+
+
+
+ private static void BFS(Animatable o, int depth)
+ {
+ if (o == null)
+ {
+ Tizen.Log.Fatal("NUI-APP", "##### o == null! return here!");
+ return;
+ }
+
+ Tizen.Log.Fatal("NUI-APP", "##### o.GetTypeName()=" + o.GetTypeName());
+
+ if (o is View)
+ {
+ View myView = o as View;
+
+ if (o is TextLabel)
+ {
+ TextLabel myTextLabel = o as TextLabel;
+
+ Tizen.Log.Fatal("NUI-APP", string.Format("it is TextLabel, {0}", myTextLabel.Text));
+
+ return;
+ }
+ else
+ {
+ Tizen.Log.Fatal("NUI-APP", string.Format("it is not TextLaebl"));
+ }
+
+ for (int i = 0; i < myView.GetChildCount(); i++)
+ {
+ BFS(myView.GetChildAt((uint)i), depth + 1);
+ }
+ }
+ else if (o is Layer)
+ {
+ Layer myLayer = o as Layer;
+
+ for (int i = 0; i < myLayer.GetChildCount(); i++)
+ {
+ BFS(myLayer.GetChildAt((uint)i), depth + 1);
+ }
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ private bool Mytimer_Tick(object source, Timer.TickEventArgs e)
+ {
+ //ObjectDumpTrigger();
+ ObjectDumpTrigger2();
+
+ return true;
+ }
+
+
+
+ //======================================================================
+ void LayerTest2()
+ {
+ layer = new Layer();
+
+ vi1 = new View();
+ vi2 = new View();
+ vi3 = new View();
+
+ tl1 = new TextLabel();
+ tl2 = new TextLabel();
+ tl3 = new TextLabel();
+
+ tb1 = new ToggleButton();
+ tb2 = new ToggleButton();
+ tb3 = new ToggleButton();
+
+ vi1.Add(vi3);
+ vi1.Add(tl1);
+ vi1.Add(tl2);
+
+ vi3.Add(tb1);
+ vi3.Add(tb2);
+
+ vi2.Add(tl3);
+
+ layer.Add(vi1);
+ layer.Add(vi2);
+ layer.Add(tb3);
+
+ Window.Instance.AddLayer(layer);
+ }
+
+ void ObjectDumpTrigger2()
+ {
+ uint layerCnt = Window.GetLayerCount();
+ Tizen.Log.Fatal("NUI-APP", "layerCnt=" + layerCnt);
+
+ for (uint i = 0; i < layerCnt; i++)
+ {
+ Tizen.Log.Fatal("NUI-APP", "T[" + DateTime.Now + "]__________ layer #" + i + " traverse");
+ CheckViewsInLayer(Window.GetLayer(i));
+ }
+ }
+ void CheckViewsInLayer(Animatable obj)
+ {
+ if (obj is Layer)
+ {
+ var layer = obj as Layer;
+ if (layer == null)
+ {
+ Tizen.Log.Fatal("NUI-APP", "### layer is null! just return!");
+ return;
+ }
+ uint childCnt = layer.GetChildCount();
+ if (childCnt > 0)
+ {
+ for (uint i = 0; i < childCnt; i++)
+ {
+ var temp = layer.GetChildAt(i) as View;
+ Tizen.Log.Fatal("NUI-APP", "depth[1] child in layer! type=" + temp?.GetTypeName());
+ ViewCheckRecurse(temp, 1);
+ }
+ }
+ else
+ {
+ Tizen.Log.Fatal("NUI-APP", "### there is no child in this layer! just return!");
+ }
+ }
+ else
+ {
+ Tizen.Log.Fatal("NUI-APP", "obj is NOT Layer! do nothing!");
+ }
+ }
+ void ViewCheckRecurse(View view, int depth)
+ {
+ if (view)
+ {
+ uint childCnt = view.GetChildCount();
+ if (childCnt > 0)
+ {
+ depth = depth + 1;
+ for (uint i = 0; i < childCnt; i++)
+ {
+ var temp = view.GetChildAt(i) as View;
+ Tizen.Log.Fatal("NUI-APP", "depth[" + depth + "] child in layer! type=" + temp.GetTypeName() + " AS-IS Test: IsView?=" + (temp is View) + " IsTextLabel?=" + (temp is TextLabel) );
+ ViewCheckRecurse(temp, depth);
+ }
+ }
+ else
+ {
+ //Tizen.Log.Fatal("NUI-APP", "depth[" + depth + "] child in layer! type=" + view.GetTypeName());
+ return;
+ }
+ }
+ else
+ {
+ //Tizen.Log.Fatal("NUI-APP", "### view is null! just return!");
+ }
+ }
+
+ private static void _Main(string[] args)
+ {
+ //Create an Application
+ Program myProgram = new Program();
+ myProgram.Run(args);
+ }
+ }
+}
\ No newline at end of file
private bool _active = false;
private const string _resPath = "/home/owner/apps_rw/NUISamples.TizenTV/res";
- private Animation _animation;
+ private Animation _animation1;
+ private Animation _animation2;
private bool _transitionInProgress = false;
private int cnt1, cnt2;
private void StartTransition(bool activate)
{
- if (_animation)
+ if (_animation1)
{
- _animation.Stop();
- _animation.Finished += OnTransitionFinished;
+ _animation1.Stop();
+ _animation1.Finished += OnTransitionFinished1;
+ }
+ if (_animation2)
+ {
+ _animation2.Stop();
+ _animation2.Finished += OnTransitionFinished2;
}
if (activate)
{
- _animation = _contentView.AnimateVisual(_icon, "Size", new Size2D(200, 200), 0, 1000, AlphaFunction.BuiltinFunctions.Linear);
+ _animation1 = _contentView.AnimateVisual(_icon, "Size", new Size2D(150, 150), 0, 1000, AlphaFunction.BuiltinFunctions.Linear);
+ _animation2 = _contentView.AnimateVisual(_icon, "Position", new Position2D(40, 40), 0, 1000);
}
else
{
- _animation = _contentView.AnimateVisual(_icon, "Size", new Position2D(50, 50), 0, 1000, AlphaFunction.BuiltinFunctions.Linear);
+ _animation1 = _contentView.AnimateVisual(_icon, "Size", new Position2D(50, 50), 0, 1000, AlphaFunction.BuiltinFunctions.Linear);
+ _animation2 = _contentView.AnimateVisual(_icon, "Position", new Position2D(5, 5), 0, 1000);
}
- if (_animation)
+ if (_animation1)
+ {
+ _animation1.Finished += OnTransitionFinished1;
+ _transitionInProgress = true;
+ _animation1.Play();
+ }
+ if (_animation2)
{
- _animation.Finished += OnTransitionFinished;
+ _animation2.Finished += OnTransitionFinished2;
_transitionInProgress = true;
- _animation.Play();
+ _animation2.Play();
+ }
+ }
+ private void OnTransitionFinished1(object sender, EventArgs e)
+ {
+ _transitionInProgress = false;
+ if (_animation1)
+ {
+ _animation1.Finished += OnTransitionFinished1;
+ _animation1.Reset();
}
}
- private void OnTransitionFinished(object sender, EventArgs e)
+ private void OnTransitionFinished2(object sender, EventArgs e)
{
_transitionInProgress = false;
- if (_animation)
+ if (_animation2)
{
- _animation.Finished += OnTransitionFinished;
- _animation.Reset();
+ _animation2.Finished += OnTransitionFinished2;
+ _animation2.Reset();
}
}
_shadowButton1.Clicked += (obj, ev) =>
{
_active1 = !_active1;
- StartTransition(_contentView1, _icon, "Offset", _active1);
+ StartTransition(_contentView1, _icon, "Position", _active1);
return true;
};
_shadowButton1.WidthResizePolicy = ResizePolicyType.FillToParent;
if (activate)
{
- if (property == "Offset")
+ if (property == "Position")
{
- _animation = view.AnimateVisual(target, property, new Position2D(20, 20), 0, 1000, AlphaFunction.BuiltinFunctions.Linear);
+ _animation = view.AnimateVisual(target, property, new Position2D(20, 20), 0, 1000, AlphaFunction.BuiltinFunctions.Linear, new Position2D(40, 40));
}
else if (property == "Opacity")
{
}
else
{
- if (property == "Offset")
+ if (property == "Position")
{
- _animation = view.AnimateVisual(target, property, new Position2D(5, 5), 0, 1000, AlphaFunction.BuiltinFunctions.Linear);
+ _animation = view.AnimateVisual(target, property, new Position2D(5, 5), 0, 1000);
}
else if (property == "Opacity")
{
- _animation = view.AnimateVisual(target, property, 1.0f, 0, 1000, AlphaFunction.BuiltinFunctions.Linear);
+ _animation = view.AnimateVisual(target, property, 1.0f, 0, 1000);
}
else if (property == "MixColor")
{
- _animation = view.AnimateVisual(target, property, Color.Red, 0, 1000, AlphaFunction.BuiltinFunctions.Linear);
+ _animation = view.AnimateVisual(target, property, Color.Red, 0, 1000);
}
}
}
}
- public static View GetViewFromActor(View view)
+
+ internal static View GetViewFromBaseHandle(BaseHandle baseHandle)
{
// we store a dictionary of ref-obects (C++ land) to custom views (C# land)
- RefObject refObj = view.GetObjectPtr();
+ RefObject refObj = baseHandle.GetObjectPtr();
IntPtr refObjectPtr = (IntPtr)RefObject.getCPtr(refObj);
WeakReference viewReference;
/// <returns>A object which inherit View</returns>
public static T DownCast<T>(View view) where T : View
{
- View ret = ViewRegistry.GetViewFromActor(view);
+ View ret = ViewRegistry.GetViewFromBaseHandle(view);
if (ret != null)
{
return (T)ret;
SetVisible(false);
}
- public void Raise()
+ internal void Raise()
{
NDalicPINVOKE.Raise(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending)
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- public void Lower()
+ internal void Lower()
{
NDalicPINVOKE.Lower(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending)
/// <returns>The view for the given index or empty handle if children not initialized</returns>
public View GetChildAt(uint index)
{
- View ret = new View(NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index), true);
+ 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 = ViewRegistry.GetViewFromBaseHandle(ret);
+
if (NDalicPINVOKE.SWIGPendingException.Pending)
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+
+ return temp ?? null;
}
/// <summary>
return ret;
}
- public Vector3 GetNaturalSize()
+ internal Vector3 GetNaturalSize()
{
Vector3 ret = new Vector3(NDalicPINVOKE.Actor_GetNaturalSize(swigCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending)
/// <param name="endTime"> The end time of visual animation.</param>
/// <param name="alphaFunction"> The alpha function of visual animation</param>
/// <returns>Animation instance</returns>
- public Animation AnimateVisual(VisualMap target, string property, object destinationValue, int startTime, int endTime, AlphaFunction.BuiltinFunctions alphaFunction)
+ public Animation AnimateVisual(VisualMap target, string property, object destinationValue, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialValue = null)
{
- string _alphaFunction = "";
- switch (alphaFunction)
+ string _alphaFunction = null;
+ if (alphaFunction != null)
{
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
+ switch (alphaFunction)
{
- _alphaFunction = "LINEAR";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
- {
- _alphaFunction = "REVERSE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
- {
- _alphaFunction = "EASE_IN_SQUARE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
- {
- _alphaFunction = "EASE_OUT_SQUARE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
- {
- _alphaFunction = "EASE_IN";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
- {
- _alphaFunction = "EASE_OUT";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
- {
- _alphaFunction = "EASE_IN_OUT";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
- {
- _alphaFunction = "EASE_IN_SINE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
- {
- _alphaFunction = "EASE_OUT_SINE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
- {
- _alphaFunction = "EASE_IN_OUT_SINE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
- {
- _alphaFunction = "BOUNCE";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
- {
- _alphaFunction = "SIN";
- break;
- }
- case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
- {
- _alphaFunction = "EASE_OUT_BACK";
- break;
- }
- default:
- {
- _alphaFunction = "DEFAULT";
- break;
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
+ {
+ _alphaFunction = "LINEAR";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
+ {
+ _alphaFunction = "REVERSE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
+ {
+ _alphaFunction = "EASE_IN_SQUARE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
+ {
+ _alphaFunction = "EASE_OUT_SQUARE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
+ {
+ _alphaFunction = "EASE_IN";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
+ {
+ _alphaFunction = "EASE_OUT";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
+ {
+ _alphaFunction = "EASE_IN_OUT";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
+ {
+ _alphaFunction = "EASE_IN_SINE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
+ {
+ _alphaFunction = "EASE_OUT_SINE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
+ {
+ _alphaFunction = "EASE_IN_OUT_SINE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
+ {
+ _alphaFunction = "BOUNCE";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
+ {
+ _alphaFunction = "SIN";
+ break;
+ }
+ case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
+ {
+ _alphaFunction = "EASE_OUT_BACK";
+ break;
+ }
+ default:
+ {
+ _alphaFunction = "DEFAULT";
+ break;
+ }
}
}
if (item.Value.Name == target.Name)
{
PropertyMap _animator = new PropertyMap();
- _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
+ if ( _alphaFunction != null) {_animator.Add("alphaFunction", new PropertyValue(_alphaFunction));}
PropertyMap _timePeriod = new PropertyMap();
_timePeriod.Add("duration", new PropertyValue((endTime - startTime) / 1000.0f));
string _str1 = property.Substring(0, 1);
string _str2 = property.Substring(1);
string _str = _str1.ToLower() + _str2;
+ if (_str == "position") {_str = "offset";}
- PropertyValue val = PropertyValue.CreateFromObject(destinationValue);
+ PropertyValue destVal = PropertyValue.CreateFromObject(destinationValue);
PropertyMap _transition = new PropertyMap();
_transition.Add("target", new PropertyValue(target.Name));
_transition.Add("property", new PropertyValue(_str));
- _transition.Add("targetValue", val);
+ if (initialValue != null)
+ {
+ PropertyValue initVal = PropertyValue.CreateFromObject(initialValue);
+ _transition.Add("initialValue", new PropertyValue(initVal));
+ }
+ _transition.Add("targetValue", destVal);
_transition.Add("animator", new PropertyValue(_animator));
TransitionData _transitionData = new TransitionData(_transition);
//temporary fix to pass TCT
- public Animation VisualAnimate(VisualAnimator visualMap)
+ public Animation VisualAnimate(Tizen.NUI.VisualAnimator visualMap)
{
foreach (var item in _visualDictionary.ToList())
{
namespace Tizen.NUI
{
+ using System;
+ using System.Runtime.InteropServices;
using Tizen.NUI.BaseComponents;
+
/// <summary>
/// Layers provide a mechanism for overlaying groups of actors on top of each other.
/// </summary>
/// <returns>The view for the given index or empty handle if children not initialized</returns>
public View GetChildAt(uint index)
{
- View ret = new View(NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index), true);
+ 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 = ViewRegistry.GetViewFromBaseHandle(ret);
+
if (NDalicPINVOKE.SWIGPendingException.Pending)
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+
+ return temp ?? null;
}
/// <summary>
internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn)
{
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
- stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
+ if (NDalicPINVOKE.Stage_IsInstalled())
+ {
+ stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent());
+ }
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj)