From 16994b4da8be60ad4882c27b83640aa5b9a15021 Mon Sep 17 00:00:00 2001 From: Feng Jin Date: Tue, 18 Apr 2017 18:50:11 +0800 Subject: [PATCH] Change "PositionUsesAnchorPoint" to public. Please run positionUsesAnchorPoint-test.cs to test it. Change-Id: I300712cf423efaf926cf46208ed729384c0d4be2 Signed-off-by: Feng Jin --- .../NUISamples.TizenTV/NUISamples.TizenTV.csproj | 1 + .../NUISamples/NUISamples.TizenTV/examples/Main.cs | 1 + .../examples/positionUsesAnchorPoint-test.cs | 97 ++++++++++++++++++++++ Tizen.NUI/src/public/Actor.cs | 2 +- 4 files changed, 100 insertions(+), 1 deletion(-) create mode 100755 NUISamples/NUISamples/NUISamples.TizenTV/examples/positionUsesAnchorPoint-test.cs diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj b/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj index 113f1ab..4769ce7 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj +++ b/NUISamples/NUISamples/NUISamples.TizenTV/NUISamples.TizenTV.csproj @@ -65,6 +65,7 @@ + diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/Main.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/Main.cs index fe11f26..46451ce 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/Main.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/Main.cs @@ -33,6 +33,7 @@ namespace NUISamples.TizenTV.examples //new VisualViewTest2.VisualSample().Run(args); //new VisualsUsingCustomView.VisualsExample().Run(args); //o //new FirstScreen.FirstScreenApp().Run(args); //o + //new PositionUsesAnchorPointTest.Example().Run(args); } } } diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/positionUsesAnchorPoint-test.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/positionUsesAnchorPoint-test.cs new file mode 100755 index 0000000..f62983e --- /dev/null +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/positionUsesAnchorPoint-test.cs @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.Constants; +//using Tizen.Applications; + +//------------------------------------------------------------------------------ +// +// +// This file can only run on Tizen target. You should compile it with DaliApplication.cs, and +// add tizen c# application related library as reference. +//------------------------------------------------------------------------------ +namespace PositionUsesAnchorPointTest +{ + class Example : NUIApplication + { + private TextLabel _text1; + private TextLabel _text2; + private Stage _stage; + + public Example():base() + { + } + + public Example(string stylesheet):base(stylesheet) + { + } + + public Example(string stylesheet, WindowMode windowMode):base(stylesheet, windowMode) + { + } + + protected override void OnCreate() + { + base.OnCreate(); + Initialize(); + } + + private void Initialize() + { + // Connect the signal callback for stage touched signal + _stage = Stage.Instance; + _text1 = new TextLabel("PositionUsesAnchorPoint"); + _text1.ParentOrigin = ParentOrigin.Center; + _text1.AnchorPoint = AnchorPoint.Center; + _text1.Position = new Position(0, 0, 0); + _text1.PositionUsesAnchorPoint = true; + _text1.HorizontalAlignment = HorizontalAlignment.HorizontalAlignCenter; + _text1.Size2D = new Size2D(200, 100); + _text1.PointSize = 10.0f; + _text1.BackgroundColor = Color.Blue; + _stage.GetDefaultLayer().Add(_text1); + + _text2 = new TextLabel("PositionNotUsesAnchorPoint"); + _text2.ParentOrigin = ParentOrigin.Center; + _text2.AnchorPoint = AnchorPoint.Center; + _text2.Position = new Position(0, 0, 0); + _text2.PositionUsesAnchorPoint = false; + _text2.HorizontalAlignment = HorizontalAlignment.HorizontalAlignCenter; + _text2.Size2D = new Size2D(200, 100); + _text2.PointSize = 10.0f; + _text2.BackgroundColor = Color.Red; + _stage.GetDefaultLayer().Add(_text2); + } + + + + /// + /// The main entry point for the application. + /// + [STAThread] + static void _Main(string[] args) + { + Tizen.Log.Debug("NUI", "Hello mono world."); + Example example = new Example("stylesheet", WindowMode.Transparent); + example.Run(args); + } + } +} diff --git a/Tizen.NUI/src/public/Actor.cs b/Tizen.NUI/src/public/Actor.cs index e58dd58..695efc2 100755 --- a/Tizen.NUI/src/public/Actor.cs +++ b/Tizen.NUI/src/public/Actor.cs @@ -157,7 +157,7 @@ namespace Tizen.NUI /// If false, then the top-left of the actor is used for the position. /// Setting this to false will allow scaling or rotation around the anchor-point without affecting the actor's position. /// - protected bool PositionUsesAnchorPoint + public bool PositionUsesAnchorPoint { get { -- 2.7.4