From 55a3906bf01bb8ae78d4c9e49eff49dae38b1bd3 Mon Sep 17 00:00:00 2001 From: "dongsug.song" Date: Mon, 20 Mar 2017 17:53:24 +0900 Subject: [PATCH] Add comments, nui 0.2.31 upgrade Change-Id: I6d09ea0e557193b31cbc3fc0e27fa21d0f421259 Signed-off-by: dongsug.song --- NUISamples/NUISamples.TizenTV/examples/test1.cs | 114 ++++++++-------- Tizen.NUI/src/public/Color.cs | 173 ++++++++++++++++++------ Tizen.NUI/src/public/FocusManager.cs | 55 ++++++++ Tizen.NUI/src/public/RelayoutContainer.cs | 32 +++-- packaging/csapi-nui.spec | 2 +- 5 files changed, 267 insertions(+), 109 deletions(-) diff --git a/NUISamples/NUISamples.TizenTV/examples/test1.cs b/NUISamples/NUISamples.TizenTV/examples/test1.cs index 0a7f970..03c8441 100755 --- a/NUISamples/NUISamples.TizenTV/examples/test1.cs +++ b/NUISamples/NUISamples.TizenTV/examples/test1.cs @@ -19,7 +19,7 @@ using Tizen.NUI; using System.Collections.Generic; -// 1) sibling order test +// 1) sibling order test namespace Test1 { class Example : NUIApplication @@ -46,62 +46,62 @@ namespace Test1 public void Initialize() { _stage = Stage.Instance; - _stage.BackgroundColor = Color.White; - - // 1) sibling order test - SiblingTest(); - - - } - - public void SiblingTest() - { - View _prev = null; - Position2D _myPos = new Position2D(100, 100); - List list_view = new List(); - TextLabel _txt = new TextLabel(); - - for (int i = 0; i < 10; i++) - { - View _view0 = new PushButton(); - PushButton _view = _view0 as PushButton; - - _view.Name = "sibling" + i; - _view.MinimumSize = new Size2D(100, 50); - _view.LabelText = "sibling" + i; - _view.ParentOrigin = ParentOrigin.TopLeft; - _view.AnchorPoint = AnchorPoint.TopLeft; - _view.Position2D = _myPos + new Position2D(20 * i, 10 * i); - _view.Clicked += (sender, ee) => - { - View curr = sender as View; - Tizen.Log.Debug("NUI", "clicked curr view name=" + curr.Name + " sibling=" + curr.SiblingOrder); - curr.RaiseToTop(); - if (_prev) - { - _prev.LowerToBottom(); - Tizen.Log.Debug("NUI", "raise on top is called!curr sibling=" + curr.SiblingOrder + " prev name=" + _prev.Name + " sibling=" + _prev.SiblingOrder); - } - _prev = curr; - _txt.Text = "on top: " + curr.Name + ", sibling order=" + curr.SiblingOrder; - return true; - }; - list_view.Add(_view); - } - - for (int i = 0; i < 10; i++) - { - _stage.GetDefaultLayer().Add(list_view[i]); - Tizen.Log.Debug("NUI", list_view[i].Name + "'s sibling order=" + list_view[i].SiblingOrder); - } - - _txt.ParentOrigin = ParentOrigin.TopLeft; - _txt.AnchorPoint = AnchorPoint.TopLeft; - _txt.Text = "on top: sibling#, sibling order=?"; - _txt.Position2D = _myPos + new Position2D(-50, 200); - _txt.TextColor = Color.Blue; - _stage.GetDefaultLayer().Add(_txt); - } + _stage.BackgroundColor = Color.White; + + // 1) sibling order test + SiblingTest(); + + + } + + public void SiblingTest() + { + View _prev = null; + Position2D _myPos = new Position2D(100, 100); + List list_view = new List(); + TextLabel _txt = new TextLabel(); + + for (int i = 0; i < 10; i++) + { + View _view0 = new PushButton(); + PushButton _view = _view0 as PushButton; + + _view.Name = "sibling" + i; + _view.MinimumSize = new Size2D(100, 50); + _view.LabelText = "sibling" + i; + _view.ParentOrigin = ParentOrigin.TopLeft; + _view.AnchorPoint = AnchorPoint.TopLeft; + _view.Position2D = _myPos + new Position2D(20 * i, 10 * i); + _view.Clicked += (sender, ee) => + { + View curr = sender as View; + Tizen.Log.Debug("NUI", "clicked curr view name=" + curr.Name + " sibling=" + curr.SiblingOrder); + curr.RaiseToTop(); + if (_prev) + { + _prev.LowerToBottom(); + Tizen.Log.Debug("NUI", "raise on top is called!curr sibling=" + curr.SiblingOrder + " prev name=" + _prev.Name + " sibling=" + _prev.SiblingOrder); + } + _prev = curr; + _txt.Text = "on top: " + curr.Name + ", sibling order=" + curr.SiblingOrder; + return true; + }; + list_view.Add(_view); + } + + for (int i = 0; i < 10; i++) + { + _stage.GetDefaultLayer().Add(list_view[i]); + Tizen.Log.Debug("NUI", list_view[i].Name + "'s sibling order=" + list_view[i].SiblingOrder); + } + + _txt.ParentOrigin = ParentOrigin.TopLeft; + _txt.AnchorPoint = AnchorPoint.TopLeft; + _txt.Text = "on top: sibling#, sibling order=?"; + _txt.Position2D = _myPos + new Position2D(-50, 200); + _txt.TextColor = Color.Blue; + _stage.GetDefaultLayer().Add(_txt); + } [STAThread] static void _Main(string[] args) diff --git a/Tizen.NUI/src/public/Color.cs b/Tizen.NUI/src/public/Color.cs index e9fe9da..9b19875 100755 --- a/Tizen.NUI/src/public/Color.cs +++ b/Tizen.NUI/src/public/Color.cs @@ -1,25 +1,29 @@ -/* - * Copyright (c) 2017 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. - * - */ +// Copyright (c) 2017 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. +// +// +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +// Some have been manually changed namespace Tizen.NUI { using System; + /// + /// Color class + /// public class Color : global::System.IDisposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; @@ -41,6 +45,9 @@ namespace Tizen.NUI DisposeQueue.Instance.Add(this); } + /// + /// To make Color instance be disposed. + /// public virtual void Dispose() { if (!Stage.IsInstalled()) @@ -64,43 +71,65 @@ namespace Tizen.NUI } } - + /// + /// Addition operator. + /// + /// First value + /// Second value + /// A Color containing the result of the addition public static Color operator +(Color arg1, Color arg2) { return arg1.Add(arg2); } + /// + /// Subtraction operator. + /// + /// First value + /// Second value + /// A Color containing the result of the subtraction public static Color operator -(Color arg1, Color arg2) { return arg1.Subtract(arg2); } + /// + /// Unary negation operator. + /// + /// Target Value + /// A Color containg the negation public static Color operator -(Color arg1) { return arg1.Subtract(); } + /// + /// Multiplication operator. + /// + /// First Value + /// Second Value + /// A Color containing the result of the multiplication public static Color operator *(Color arg1, Color arg2) { return arg1.Multiply(arg2); } - public static Color operator *(Color arg1, float arg2) - { - return arg1.Multiply(arg2); - } - + /// + /// Division operator. + /// + /// First Value + /// Second Value + /// A Color containing the result of the division public static Color operator /(Color arg1, Color arg2) { return arg1.Divide(arg2); } - public static Color operator /(Color arg1, float arg2) - { - return arg1.Divide(arg2); - } - - + /// + /// Array subscript operator overload. + /// + /// Subscript index + /// The float at the given index public float this[uint index] { get @@ -109,24 +138,38 @@ namespace Tizen.NUI } } - public static Color GetColorFromPtr(global::System.IntPtr cPtr) + internal static Color GetColorFromPtr(global::System.IntPtr cPtr) { Color ret = new Color(cPtr, false); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - + /// + /// Default constructor + /// public Color() : this(NDalicPINVOKE.new_Vector4__SWIG_0(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + + /// + /// Constructor. + /// + /// red component + /// green component + /// blue component + /// alpha component public Color(float r, float g, float b, float a) : this(NDalicPINVOKE.new_Vector4__SWIG_1(r, g, b, a), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Conversion constructor from an array of four floats. + /// + /// array Array of R,G,B,A public Color(float[] array) : this(NDalicPINVOKE.new_Vector4__SWIG_2(array), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -167,13 +210,6 @@ namespace Tizen.NUI return ret; } - private Color Multiply(float rhs) - { - Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_1(swigCPtr, rhs), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - private Color MultiplyAssign(Color rhs) { Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false); @@ -195,12 +231,6 @@ namespace Tizen.NUI return ret; } - private Color Divide(float rhs) - { - Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_1(swigCPtr, rhs), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } private Color DivideAssign(Color rhs) { @@ -223,6 +253,11 @@ namespace Tizen.NUI return ret; } + /// + /// Check if two Color classes are same. + /// + /// A Color to be compared + /// If two Colors are are same, then true. public bool EqualTo(Color rhs) { bool ret = NDalicPINVOKE.Vector4_EqualTo(swigCPtr, Color.getCPtr(rhs)); @@ -233,6 +268,11 @@ namespace Tizen.NUI return ret; } + /// + /// Check if two Color classes are different. + /// + /// A Color to be compared + /// If two Colors are are different, then true. public bool NotEqualTo(Color rhs) { bool ret = NDalicPINVOKE.Vector4_NotEqualTo(swigCPtr, Color.getCPtr(rhs)); @@ -248,6 +288,9 @@ namespace Tizen.NUI return ret; } + /// + /// red component + /// public float R { set @@ -263,6 +306,9 @@ namespace Tizen.NUI } } + /// + /// green component + /// public float G { set @@ -278,6 +324,9 @@ namespace Tizen.NUI } } + /// + /// blue component + /// public float B { set @@ -293,6 +342,9 @@ namespace Tizen.NUI } } + /// + /// alpha component + /// public float A { set @@ -308,6 +360,9 @@ namespace Tizen.NUI } } + /// + /// Get black colored Color class + /// public static Color Black { get @@ -319,6 +374,9 @@ namespace Tizen.NUI } } + /// + /// Get white colored Color class + /// public static Color White { get @@ -330,6 +388,9 @@ namespace Tizen.NUI } } + /// + /// Get red colored Color class + /// public static Color Red { get @@ -341,6 +402,9 @@ namespace Tizen.NUI } } + /// + /// Get green colored Color class + /// public static Color Green { get @@ -352,6 +416,9 @@ namespace Tizen.NUI } } + /// + /// Get blue colored Color class + /// public static Color Blue { get @@ -363,6 +430,9 @@ namespace Tizen.NUI } } + /// + /// Get yellow colored Color class + /// public static Color Yellow { get @@ -374,6 +444,9 @@ namespace Tizen.NUI } } + /// + /// Get magenta colored Color class + /// public static Color Magenta { get @@ -385,6 +458,9 @@ namespace Tizen.NUI } } + /// + /// Get cyan colored Color class + /// public static Color Cyan { get @@ -396,6 +472,9 @@ namespace Tizen.NUI } } + /// + /// Get transparent colored Color class + /// public static Color Transparent { get @@ -407,11 +486,19 @@ namespace Tizen.NUI } } + /// + /// convert Color class to Vector4 class implicitly. + /// + /// A Color to be converted to Vector4 public static implicit operator Vector4(Color color) { return new Vector4(color.R, color.G, color.B, color.A); } + /// + /// convert Vector4 class to Color class implicitly. + /// + /// A Vector4 to be converted to Color public static implicit operator Color(Vector4 vec) { return new Color(vec.R, vec.G, vec.B, vec.A); diff --git a/Tizen.NUI/src/public/FocusManager.cs b/Tizen.NUI/src/public/FocusManager.cs index be844dd..41eb40c 100755 --- a/Tizen.NUI/src/public/FocusManager.cs +++ b/Tizen.NUI/src/public/FocusManager.cs @@ -23,6 +23,11 @@ namespace Tizen.NUI using System; using System.Runtime.InteropServices; + /// + /// Provides the functionality of handling keyboard navigation and maintaining the two dimensional keyboard focus chain. + /// It provides functionality of setting the focus and moving the focus in four directions(i.e.Left, Right, Up and Down). + /// It also draws a highlight for the focused View and sends a event when the focus is changed. + /// public class FocusManager : BaseHandle { private global::System.Runtime.InteropServices.HandleRef swigCPtr; @@ -42,6 +47,9 @@ namespace Tizen.NUI DisposeQueue.Instance.Add(this); } + /// + /// To make FocusManager instance be disposed. + /// public override void Dispose() { if (!Stage.IsInstalled()) @@ -382,6 +390,13 @@ namespace Tizen.NUI return ret; } + /// + /// Moves the keyboard focus to the given View. + /// Only one View can be focused at the same time. + /// The View must be in the stage already and keyboard focusable. + /// + /// The View to be focused + /// Whether the focus is successful or not public bool SetCurrentFocusView(View view) { bool ret = NDalicManualPINVOKE.FocusManager_SetCurrentFocusActor(swigCPtr, Actor.getCPtr(view)); @@ -389,6 +404,10 @@ namespace Tizen.NUI return ret; } + /// + /// Gets the current focused actor. + /// + /// A handle to the current focused View or an empty handle if no View is focused public View GetCurrentFocusView() { View ret = View.DownCast(new Actor(NDalicManualPINVOKE.FocusManager_GetCurrentFocusActor(swigCPtr), true)); @@ -396,6 +415,11 @@ namespace Tizen.NUI return ret; } + /// + /// Moves the focus to the next focusable View in the focus chain in the given direction(according to the focus traversal order). + /// + /// The direction of focus movement + /// true if the movement was successful public bool MoveFocus(View.FocusDirection direction) { bool ret = NDalicManualPINVOKE.FocusManager_MoveFocus(swigCPtr, (int)direction); @@ -403,12 +427,20 @@ namespace Tizen.NUI return ret; } + /// + /// Clears the focus from the current focused actor if any, so that no actor is focused in the focus chain. + /// It will emit FocusChanged event without current focused View. + /// public void ClearFocus() { NDalicManualPINVOKE.FocusManager_ClearFocus(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Sets/Gets the status of whether the focus movement should be looped within the same focus group. + /// The focus movement is not looped by default. + /// public bool FocusGroupLoop { set @@ -434,12 +466,23 @@ namespace Tizen.NUI return ret; } + /// + /// Sets whether an View is a focus group that can limit the scope of focus movement to its child actors in the focus chain. + /// Layout controls set themselves as focus groups by default. + /// + /// The View to be set as a focus group + /// Whether to set the View as a focus group or not public void SetAsFocusGroup(View view, bool isFocusGroup) { NDalicManualPINVOKE.FocusManager_SetAsFocusGroup(swigCPtr, Actor.getCPtr(view), isFocusGroup); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Checks whether the actor is set as a focus group or not. + /// + /// The View to be checked + /// Whether the View is set as a focus group public bool IsFocusGroup(View view) { bool ret = NDalicManualPINVOKE.FocusManager_IsFocusGroup(swigCPtr, Actor.getCPtr(view)); @@ -447,6 +490,11 @@ namespace Tizen.NUI return ret; } + /// + /// Returns the closest ancestor of the given actor that is a focus group. + /// + /// The View to be checked for its focus group + /// The focus group the given view belongs to or an empty handle if the given view public View GetFocusGroup(View view) { View ret = View.DownCast(new Actor(NDalicManualPINVOKE.FocusManager_GetFocusGroup(swigCPtr, Actor.getCPtr(view)), true)); @@ -454,6 +502,10 @@ namespace Tizen.NUI return ret; } + /// + /// Sets/Gets the focus indicator View. + /// This will replace the default focus indicator view in FocusManager and will be added to the focused view as a highlight. + /// public View FocusIndicator { set @@ -509,6 +561,9 @@ namespace Tizen.NUI private static readonly FocusManager instance = FocusManager.Get(); + /// + /// Gets the singleton of FocusManager object. + /// public static FocusManager Instance { get diff --git a/Tizen.NUI/src/public/RelayoutContainer.cs b/Tizen.NUI/src/public/RelayoutContainer.cs index cf01adb..379a50e 100755 --- a/Tizen.NUI/src/public/RelayoutContainer.cs +++ b/Tizen.NUI/src/public/RelayoutContainer.cs @@ -1,12 +1,21 @@ -//------------------------------------------------------------------------------ -// +// Copyright (c) 2017 Samsung Electronics Co., Ltd. // -// This file was automatically generated by SWIG (http://www.swig.org). -// Version 3.0.9 +// 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 // -// Do not make changes to this file unless you know what you are doing--modify -// the SWIG interface file instead. -//------------------------------------------------------------------------------ +// 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. +// +// +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +// Some have been manually changed + namespace Tizen.NUI { @@ -35,6 +44,9 @@ namespace Tizen.NUI DisposeQueue.Instance.Add(this); } + /// + /// To make RelayoutContainer instance be disposed. + /// public virtual void Dispose() { if (!Stage.IsInstalled()) @@ -58,7 +70,11 @@ namespace Tizen.NUI } } - + /// + /// Adds relayout information to the container if it doesn't already exist. + /// + /// The actor to relayout + /// The size to relayout public virtual void Add(Actor actor, Size2D size) { NDalicPINVOKE.RelayoutContainer_Add(swigCPtr, Actor.getCPtr(actor), Size2D.getCPtr(size)); diff --git a/packaging/csapi-nui.spec b/packaging/csapi-nui.spec index 10ba4b5..c4c71d3 100755 --- a/packaging/csapi-nui.spec +++ b/packaging/csapi-nui.spec @@ -1,6 +1,6 @@ Name: csapi-nui Summary: dali-NUI -Version: 0.2.30 +Version: 0.2.31 Release: 1 Group: Development/Libraries License: Apache-2.0 -- 2.7.4