From 8cdf309a3feb2600dc02c24a366d16457495696d Mon Sep 17 00:00:00 2001 From: "xb.teng" Date: Tue, 11 Apr 2017 23:49:22 +0800 Subject: [PATCH] [NUI-252] change string type of property to enum type of property Change-Id: I64aa478b559d7222d6f33c112da48e90da5672ad Signed-off-by: xb.teng --- .../examples/control-dashboard.cs | 13 +- .../NUISamples.TizenTV/examples/dali-test.cs | 2 +- .../NUISamples.TizenTV/examples/hello-test.cs | 3 +- .../NUISamples.TizenTV/examples/hello-world.cs | 3 +- .../NUISamples.TizenTV/examples/scroll-view.cs | 4 +- .../examples/user-alphafunction.cs | 2 +- .../examples/visual-animation-test.cs | 3 +- .../examples/visual-view-test.cs | 1 + .../visuals-using-custom-view.cs | 2 +- .../NUISamples.TizenTV/firstscreen/App.cs | 4 +- Tizen.NUI/src/public/Button.cs | 75 ++++++++- Tizen.NUI/src/public/CameraActor.cs | 76 ++++++++- Tizen.NUI/src/public/CustomView/Spin.cs | 4 +- Tizen.NUI/src/public/CustomView/VisualView.cs | 2 +- Tizen.NUI/src/public/Popup.cs | 163 ++++++++++++++++++-- Tizen.NUI/src/public/PushButton.cs | 79 +++++++++- Tizen.NUI/src/public/ScrollBar.cs | 78 +++++++++- Tizen.NUI/src/public/TextEditor.cs | 46 +++++- Tizen.NUI/src/public/TextField.cs | 92 ++++++++++- Tizen.NUI/src/public/TextLabel.cs | 129 +++++++++++++++- Tizen.NUI/src/public/View.cs | 170 ++++++++++++++++++--- Tizen.NUI/src/public/VisualMaps.cs | 100 +++++++++--- 22 files changed, 940 insertions(+), 111 deletions(-) diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/control-dashboard.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/control-dashboard.cs index 1c5c348..f2e408f 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/control-dashboard.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/control-dashboard.cs @@ -18,6 +18,7 @@ using System; using System.Runtime.InteropServices; using Tizen.NUI; +using Tizen.NUI.Constants; namespace ControlDashboard { @@ -88,8 +89,8 @@ namespace ControlDashboard topLabel.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f); topLabel.TextColor = Color.White; topLabel.Text = " DALi Views"; - topLabel.HorizontalAlignment = "BEGIN"; - topLabel.VerticalAlignment = "CENTER"; + topLabel.HorizontalAlignment = HorizontalAlignment.HorizontalAlignBegin; + topLabel.VerticalAlignment = VerticalAlignment.VerticalAlignCenter; topLabel.PointSize = 42.0f; _stage.GetDefaultLayer().Add(topLabel); //StyleManager.Get().ApplyStyle(topLabel, _resPath + "/json/control-dashboard-theme.json", "TextFieldFontSize4"); @@ -140,8 +141,8 @@ namespace ControlDashboard // Make label for item TextLabel itemLabel = new TextLabel(" " + item.name); itemLabel.Size = new Vector3(_stage.Size.Width * 0.2f, _stage.Size.Height * 0.05f, 0.0f); - itemLabel.HorizontalAlignment = "BEGIN"; - itemLabel.VerticalAlignment = "BOTTOM"; + itemLabel.HorizontalAlignment = HorizontalAlignment.HorizontalAlignBegin; + itemLabel.VerticalAlignment = VerticalAlignment.VerticalAlignBottom; //itemLabel.PointSize = 18.0f; _contentContainer.AddChild(itemLabel, new TableView.CellPosition(((uint)idx / 5) * 2, (uint)idx % 5)); @@ -359,7 +360,7 @@ namespace ControlDashboard TextLabel text = new TextLabel("This is a Toast.\nIt will auto-hide itself"); text.TextColor = Color.White; text.MultiLine = true; - text.HorizontalAlignment = "center"; + text.HorizontalAlignment = HorizontalAlignment.HorizontalAlignCenter; toast.SetTitle(text); _stage.GetDefaultLayer().Add(toast); toast.SetDisplayState(Popup.DisplayStateType.Shown); @@ -431,7 +432,7 @@ namespace ControlDashboard TextLabel titleActor = new TextLabel(title); titleActor.TextColor = Color.White; titleActor.MultiLine = true; - titleActor.HorizontalAlignment = "center"; + titleActor.HorizontalAlignment = HorizontalAlignment.HorizontalAlignCenter; return titleActor; } diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/dali-test.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/dali-test.cs index 2fb9920..1306be6 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/dali-test.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/dali-test.cs @@ -151,7 +151,7 @@ namespace DaliTest TextLabel text = new TextLabel("Hello Mono World"); text.ParentOrigin = ParentOrigin.Center; text.AnchorPoint = AnchorPoint.Center; - text.HorizontalAlignment = "CENTER"; + text.HorizontalAlignment = HorizontalAlignment.HorizontalAlignCenter; stage.GetDefaultLayer().Add(text); Console.WriteLine( "Text label text: " + text.Text ); diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/hello-test.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/hello-test.cs index 3664442..d9d662e 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/hello-test.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/hello-test.cs @@ -18,6 +18,7 @@ using System; using System.Runtime.InteropServices; using Tizen.NUI; +using Tizen.NUI.Constants; //using Tizen.Applications; //------------------------------------------------------------------------------ @@ -63,7 +64,7 @@ namespace HelloTest _text = new TextLabel("Hello Mono World"); _text.ParentOrigin = ParentOrigin.Center; _text.AnchorPoint = AnchorPoint.Center; - _text.HorizontalAlignment = "CENTER"; + _text.HorizontalAlignment = HorizontalAlignment.HorizontalAlignCenter; _text.PointSize = 32.0f; _stage.GetDefaultLayer().Add(_text); diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/hello-world.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/hello-world.cs index e907b24..3ebd9f1 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/hello-world.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/hello-world.cs @@ -18,6 +18,7 @@ using System; using System.Runtime.InteropServices; using Tizen.NUI; +using Tizen.NUI.Constants; using Tizen.NUI.Extension.Test; namespace HelloWorldTest @@ -58,7 +59,7 @@ namespace HelloWorldTest _text = new TextLabel("Hello NUI World"); _text.ParentOrigin = ParentOrigin.Center; _text.AnchorPoint = AnchorPoint.Center; - _text.HorizontalAlignment = "CENTER"; + _text.HorizontalAlignment = HorizontalAlignment.HorizontalAlignCenter; _text.PointSize = 32.0f; _text.TextColor = Color.Magenta; stage.GetDefaultLayer().Add(_text); diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/scroll-view.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/scroll-view.cs index 4fc206b..11bada9 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/scroll-view.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/scroll-view.cs @@ -18,13 +18,13 @@ using System; using System.Runtime.InteropServices; using Tizen.NUI; +using Tizen.NUI.Constants; namespace ScrollViewTest { class Example : NUIApplication { private const string resources = "/home/owner/apps_rw/NUISamples.TizenTV/res"; - [UnmanagedFunctionPointer(CallingConvention.StdCall)] delegate void CallbackDelegate(IntPtr data); @@ -141,7 +141,7 @@ namespace ScrollViewTest _text = new TextLabel("View Touch Event Handler Test"); _text.ParentOrigin = ParentOrigin.Center; _text.AnchorPoint = AnchorPoint.Center; - _text.HorizontalAlignment = "CENTER"; + _text.HorizontalAlignment = HorizontalAlignment.HorizontalAlignCenter; _text.PointSize = 20.0f; _scrollView.Add(_text); diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/user-alphafunction.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/user-alphafunction.cs index 261e6cc..dfc32e7 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/user-alphafunction.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/user-alphafunction.cs @@ -71,7 +71,7 @@ namespace UserAlphaFunctionTest _text = new TextLabel("Hello Mono World"); _text.ParentOrigin = ParentOrigin.BottomCenter; _text.AnchorPoint = AnchorPoint.BottomCenter; - _text.HorizontalAlignment = "CENTER"; + _text.HorizontalAlignment = HorizontalAlignment.HorizontalAlignCenter; _text.PointSize = 32.0f; stage.GetDefaultLayer().Add(_text); diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test.cs index f3e9115..4be05bc 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-animation-test.cs @@ -18,6 +18,7 @@ using System; using System.Runtime.InteropServices; using Tizen.NUI; +using Tizen.NUI.Constants; namespace VisaulAnimationExample { @@ -73,7 +74,7 @@ namespace VisaulAnimationExample _title.SetStyleName("Title"); _title.WidthResizePolicy = ResizePolicyType.FillToParent; _title.HeightResizePolicy = ResizePolicyType.UseNaturalSize; - _title.HorizontalAlignment = "CENTER"; + _title.HorizontalAlignment = HorizontalAlignment.HorizontalAlignCenter; titleLayout.AddChild(_title, new TableView.CellPosition(0, 0)); titleLayout.SetFitHeight(0); diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-view-test.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-view-test.cs index a22b068..d9be666 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-view-test.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visual-view-test.cs @@ -18,6 +18,7 @@ using System; using System.Runtime.InteropServices; using Tizen.NUI; +using Tizen.NUI.Constants; namespace VisualViewTest { diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/visuals-using-custom-view.cs b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/visuals-using-custom-view.cs index 9d86a6e..78754ac 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/visuals-using-custom-view.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/examples/visuals-using-custom-view/visuals-using-custom-view.cs @@ -64,7 +64,7 @@ namespace VisualsUsingCustomView title.StyleName = "Title"; title.WidthResizePolicy = ResizePolicyType.FillToParent; title.HeightResizePolicy = ResizePolicyType.UseNaturalSize; - title.HorizontalAlignment = "CENTER"; + title.HorizontalAlignment = HorizontalAlignment.HorizontalAlignCenter; contentLayout.Add(title); contentLayout.SetFitHeight(0); diff --git a/NUISamples/NUISamples/NUISamples.TizenTV/firstscreen/App.cs b/NUISamples/NUISamples/NUISamples.TizenTV/firstscreen/App.cs index ecf029d..834d68d 100755 --- a/NUISamples/NUISamples/NUISamples.TizenTV/firstscreen/App.cs +++ b/NUISamples/NUISamples/NUISamples.TizenTV/firstscreen/App.cs @@ -442,8 +442,8 @@ namespace FirstScreen _dateOfTest.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f); _dateOfTest.TextColor = Color.White; _dateOfTest.Text = " Common Interface Define Verification Test of 2017-02-10 #1"; - _dateOfTest.HorizontalAlignment = "BEGIN"; - _dateOfTest.VerticalAlignment = "CENTER"; + _dateOfTest.HorizontalAlignment = HorizontalAlignment.HorizontalAlignBegin; + _dateOfTest.VerticalAlignment = VerticalAlignment.VerticalAlignCenter; _dateOfTest.PointSize = 12.0f; _dateOfTest.UnderlineEnabled = true; _stage.GetDefaultLayer().Add(_dateOfTest); diff --git a/Tizen.NUI/src/public/Button.cs b/Tizen.NUI/src/public/Button.cs index 0964c4a..1202d09 100755 --- a/Tizen.NUI/src/public/Button.cs +++ b/Tizen.NUI/src/public/Button.cs @@ -400,17 +400,61 @@ namespace Tizen.NUI /// /// Gets/Sets the position of the the label in relation to the foreground/icon if both present /// - public string LabelRelativeAlignment + public Align LabelRelativeAlignment { get { string temp; - GetProperty(Button.Property.LABEL_RELATIVE_ALIGNMENT).Get(out temp); - return temp; + if (GetProperty(Button.Property.LABEL_RELATIVE_ALIGNMENT).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "LabelRelativeAlignment get error!"); + } + switch (temp) + { + case "BEGIN": + return Align.Begin; + case "END": + return Align.End; + case "TOP": + return Align.Top; + case "BOTTOM": + return Align.Bottom; + default: + return Align.End; + } } set { - SetProperty(Button.Property.LABEL_RELATIVE_ALIGNMENT, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case Align.Begin: + { + valueToString = "BEGIN"; + break; + } + case Align.End: + { + valueToString = "END"; + break; + } + case Align.Top: + { + valueToString = "TOP"; + break; + } + case Align.Bottom: + { + valueToString = "BOTTOM"; + break; + } + default: + { + valueToString = "END"; + break; + } + } + SetProperty(Button.Property.LABEL_RELATIVE_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); } } @@ -901,6 +945,29 @@ namespace Tizen.NUI } } + /// + /// Enumeration for describing the position the text label can be in relation to the control(and foreground/icon). + /// + public enum Align + { + /// + /// At the start of the control before the foreground/icon + /// + Begin, + /// + /// At the end of the control after the foreground/icon + /// + End, + /// + /// At the top of the control above the foreground/icon + /// + Top, + /// + /// At the bottom of the control below the foreground/icon + /// + Bottom + } + } } \ No newline at end of file diff --git a/Tizen.NUI/src/public/CameraActor.cs b/Tizen.NUI/src/public/CameraActor.cs index 57f1af9..3f5f16a 100755 --- a/Tizen.NUI/src/public/CameraActor.cs +++ b/Tizen.NUI/src/public/CameraActor.cs @@ -312,34 +312,94 @@ namespace Tizen.NUI /// /// Gets/Sets the camera type. The default type is FreeLook /// - public string Type + public CameraType Type { get { string temp; - GetProperty(CameraActor.Property.TYPE).Get(out temp); - return temp; + if (GetProperty(CameraActor.Property.TYPE).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "CameraType get error!"); + } + switch (temp) + { + case "LOOK_AT_TARGET": + return CameraType.LookAtTarget; + case "FREE_LOOK": + return CameraType.FreeLook; + default: + return CameraType.FreeLook; + } } set { - SetProperty(CameraActor.Property.TYPE, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case CameraType.LookAtTarget: + { + valueToString = "LOOK_AT_TARGET"; + break; + } + case CameraType.FreeLook: + { + valueToString = "FREE_LOOK"; + break; + } + default: + { + valueToString = "FREE_LOOK"; + break; + } + } + SetProperty(CameraActor.Property.TYPE, new Tizen.NUI.PropertyValue(valueToString)); } } /// /// Gets/Sets the projection mode. /// - public string ProjectionMode + public ProjectionMode ProjectionMode { get { string temp; - GetProperty(CameraActor.Property.PROJECTION_MODE).Get(out temp); - return temp; + if (GetProperty(CameraActor.Property.PROJECTION_MODE).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "ProjectionMode get error!"); + } + switch(temp) + { + case "PERSPECTIVE_PROJECTION": + return ProjectionMode.PerspectiveProjection; + case "ORTHOGRAPHIC_PROJECTION": + return ProjectionMode.OrthographicProjection; + default: + return ProjectionMode.PerspectiveProjection; + } } set { - SetProperty(CameraActor.Property.PROJECTION_MODE, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case ProjectionMode.PerspectiveProjection: + { + valueToString = "PERSPECTIVE_PROJECTION"; + break; + } + case ProjectionMode.OrthographicProjection: + { + valueToString = "ORTHOGRAPHIC_PROJECTION"; + break; + } + default: + { + valueToString = "PERSPECTIVE_PROJECTION"; + break; + } + } + SetProperty(CameraActor.Property.PROJECTION_MODE, new Tizen.NUI.PropertyValue(valueToString)); } } diff --git a/Tizen.NUI/src/public/CustomView/Spin.cs b/Tizen.NUI/src/public/CustomView/Spin.cs index 4fe2bcd..efa4161 100755 --- a/Tizen.NUI/src/public/CustomView/Spin.cs +++ b/Tizen.NUI/src/public/CustomView/Spin.cs @@ -98,8 +98,8 @@ namespace Tizen.NUI _textField.SizeModeFactor = new Vector3(1.0f, 0.45f, 1.0f); _textField.PlaceholderText = "----"; _textField.BackgroundColor = _textBackgroundColor; - _textField.HorizontalAlignment = "Center"; - _textField.VerticalAlignment = "Center"; + _textField.HorizontalAlignment = Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignCenter; + _textField.VerticalAlignment = Tizen.NUI.Constants.VerticalAlignment.VerticalAlignCenter; _textField.Focusable = (true); _textField.Name = "_textField"; diff --git a/Tizen.NUI/src/public/CustomView/VisualView.cs b/Tizen.NUI/src/public/CustomView/VisualView.cs index 82684a7..f43bceb 100755 --- a/Tizen.NUI/src/public/CustomView/VisualView.cs +++ b/Tizen.NUI/src/public/CustomView/VisualView.cs @@ -201,7 +201,7 @@ namespace Tizen.NUI { TransitionData _transitionData = new TransitionData(visualMap.OutputVisualMap); return this.CreateTransition(_transitionData); - } + } } return null; } diff --git a/Tizen.NUI/src/public/Popup.cs b/Tizen.NUI/src/public/Popup.cs index f9f3c4e..3b69235 100755 --- a/Tizen.NUI/src/public/Popup.cs +++ b/Tizen.NUI/src/public/Popup.cs @@ -631,17 +631,61 @@ namespace Tizen.NUI /// /// Popup display state. /// - public string DisplayState + public DisplayStateType DisplayState { get { string temp; - GetProperty(Popup.Property.DISPLAY_STATE).Get(out temp); - return temp; + if (GetProperty(Popup.Property.DISPLAY_STATE).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "DisplayState get error!"); + } + switch (temp) + { + case "SHOWING": + return DisplayStateType.Showing; + case "SHOWN": + return DisplayStateType.Shown; + case "HIDING": + return DisplayStateType.Hiding; + case "HIDDEN": + return DisplayStateType.Hidden; + default: + return DisplayStateType.Hidden; + } } set { - SetProperty(Popup.Property.DISPLAY_STATE, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case DisplayStateType.Showing: + { + valueToString = "SHOWING"; + break; + } + case DisplayStateType.Shown: + { + valueToString = "SHOWN"; + break; + } + case DisplayStateType.Hiding: + { + valueToString = "HIDING"; + break; + } + case DisplayStateType.Hidden: + { + valueToString = "HIDDEN"; + break; + } + default: + { + valueToString = "HIDDEN"; + break; + } + } + SetProperty(Popup.Property.DISPLAY_STATE, new Tizen.NUI.PropertyValue(valueToString)); } } /// @@ -695,17 +739,68 @@ namespace Tizen.NUI /// /// Contextual mode. /// - public string ContextualMode + public ContextualModeType ContextualMode { get { string temp; - GetProperty(Popup.Property.CONTEXTUAL_MODE).Get(out temp); - return temp; + if (GetProperty(Popup.Property.CONTEXTUAL_MODE).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "ContextualMode get error!"); + } + switch (temp) + { + case "NON_CONTEXTUAL": + return ContextualModeType.NonContextual; + case "ABOVE": + return ContextualModeType.Above; + case "RIGHT": + return ContextualModeType.Rright; + case "BELOW": + return ContextualModeType.Below; + case "LEFT": + return ContextualModeType.Left; + default: + return ContextualModeType.Below; + } } set { - SetProperty(Popup.Property.CONTEXTUAL_MODE, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case ContextualModeType.NonContextual: + { + valueToString = "NON_CONTEXTUAL"; + break; + } + case ContextualModeType.Above: + { + valueToString = "ABOVE"; + break; + } + case ContextualModeType.Rright: + { + valueToString = "RIGHT"; + break; + } + case ContextualModeType.Below: + { + valueToString = "BELOW"; + break; + } + case ContextualModeType.Left: + { + valueToString = "LEFT"; + break; + } + default: + { + valueToString = "BELOW"; + break; + } + } + SetProperty(Popup.Property.CONTEXTUAL_MODE, new Tizen.NUI.PropertyValue(valueToString)); } } /// @@ -727,17 +822,61 @@ namespace Tizen.NUI /// /// Animation mode. /// - public string AnimationMode + public AnimationModeType AnimationMode { get { string temp; - GetProperty(Popup.Property.ANIMATION_MODE).Get(out temp); - return temp; + if (GetProperty(Popup.Property.ANIMATION_MODE).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "AnimationMode get error!"); + } + switch (temp) + { + case "NONE": + return AnimationModeType.None; + case "ZOOM": + return AnimationModeType.Zoom; + case "FADE": + return AnimationModeType.Fade; + case "CUSTOM": + return AnimationModeType.Custom; + default: + return AnimationModeType.Fade; + } } set { - SetProperty(Popup.Property.ANIMATION_MODE, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case AnimationModeType.None: + { + valueToString = "NONE"; + break; + } + case AnimationModeType.Zoom: + { + valueToString = "ZOOM"; + break; + } + case AnimationModeType.Fade: + { + valueToString = "FADE"; + break; + } + case AnimationModeType.Custom: + { + valueToString = "CUSTOM"; + break; + } + default: + { + valueToString = "FADE"; + break; + } + } + SetProperty(Popup.Property.ANIMATION_MODE, new Tizen.NUI.PropertyValue(valueToString)); } } /// diff --git a/Tizen.NUI/src/public/PushButton.cs b/Tizen.NUI/src/public/PushButton.cs index 4a22ce2..ef75431 100755 --- a/Tizen.NUI/src/public/PushButton.cs +++ b/Tizen.NUI/src/public/PushButton.cs @@ -245,17 +245,61 @@ namespace Tizen.NUI /// /// Sets the icon alignment. /// - public string IconAlignment + public IconAlignmentType IconAlignment { get { string temp; - GetProperty(PushButton.Property.ICON_ALIGNMENT).Get(out temp); - return temp; + if (GetProperty(PushButton.Property.ICON_ALIGNMENT).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "IconAlignment get error!"); + } + switch (temp) + { + case "LEFT": + return IconAlignmentType.Left; + case "RIGHT": + return IconAlignmentType.Right; + case "TOP": + return IconAlignmentType.Top; + case "BOTTOM": + return IconAlignmentType.Bottom; + default: + return IconAlignmentType.Default; + } } set { - SetProperty(PushButton.Property.ICON_ALIGNMENT, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case IconAlignmentType.Left: + { + valueToString = "LEFT"; + break; + } + case IconAlignmentType.Right: + { + valueToString = "RIGHT"; + break; + } + case IconAlignmentType.Top: + { + valueToString = "TOP"; + break; + } + case IconAlignmentType.Bottom: + { + valueToString = "BOTTOM"; + break; + } + default: + { + valueToString = "DEFAULT"; + break; + } + } + SetProperty(PushButton.Property.ICON_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); } } /// @@ -292,6 +336,33 @@ namespace Tizen.NUI } } + /// + /// Enumeration for the alignment modes of the icon. + /// + public enum IconAlignmentType + { + /// + /// Icon located to the left of text. + /// + Left, + /// + /// Icon located to the right of text. + /// + Right, + /// + /// Icon located to the top of text. + /// + Top, + /// + /// Icon located to the bottom of text. + /// + Bottom, + /// + /// Icon located to the right of text by default. + /// + Default = Right + } + } } diff --git a/Tizen.NUI/src/public/ScrollBar.cs b/Tizen.NUI/src/public/ScrollBar.cs index fb93738..045e1a0 100755 --- a/Tizen.NUI/src/public/ScrollBar.cs +++ b/Tizen.NUI/src/public/ScrollBar.cs @@ -442,34 +442,96 @@ namespace Tizen.NUI /// /// Direction of scroll bar /// - public string ScrollDirection + public Direction ScrollDirection { get { string temp; - GetProperty(ScrollBar.Property.SCROLL_DIRECTION).Get(out temp); - return temp; + if (GetProperty(ScrollBar.Property.SCROLL_DIRECTION).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "ScrollDirection get error!"); + } + + switch (temp) + { + case "Vertical": + return Direction.Vertical; + case "Horizontal": + return Direction.Horizontal; + default: + return Direction.Vertical; + } } set { - SetProperty(ScrollBar.Property.SCROLL_DIRECTION, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case Direction.Vertical: + { + valueToString = "Vertical"; + break; + } + case Direction.Horizontal: + { + valueToString = "Horizontal"; + break; + } + default: + { + valueToString = "Vertical"; + break; + } + } + SetProperty(ScrollBar.Property.SCROLL_DIRECTION, new Tizen.NUI.PropertyValue(valueToString)); } } /// /// Indicator height policy. /// - public string IndicatorHeightPolicy + public IndicatorHeightPolicyType IndicatorHeightPolicy { get { string temp; - GetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY).Get(out temp); - return temp; + if (GetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "IndicatorHeightPolicy get error!"); + } + + switch (temp) + { + case "Variable": + return IndicatorHeightPolicyType.Variable; + case "Fixed": + return IndicatorHeightPolicyType.Fixed; + default: + return IndicatorHeightPolicyType.Variable; + } } set { - SetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case IndicatorHeightPolicyType.Variable: + { + valueToString = "Variable"; + break; + } + case IndicatorHeightPolicyType.Fixed: + { + valueToString = "Fixed"; + break; + } + default: + { + valueToString = "Variable"; + break; + } + } + SetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY, new Tizen.NUI.PropertyValue(valueToString)); } } diff --git a/Tizen.NUI/src/public/TextEditor.cs b/Tizen.NUI/src/public/TextEditor.cs index bb48788..a9e78b9 100755 --- a/Tizen.NUI/src/public/TextEditor.cs +++ b/Tizen.NUI/src/public/TextEditor.cs @@ -459,17 +459,55 @@ namespace Tizen.NUI /// /// Horizontal alignment property. /// - public string HorizontalAlignment + public Tizen.NUI.Constants.HorizontalAlignment HorizontalAlignment { get { string temp; - GetProperty(TextEditor.Property.HORIZONTAL_ALIGNMENT).Get(out temp); - return temp; + if (GetProperty(TextEditor.Property.HORIZONTAL_ALIGNMENT).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "HorizontalAlignment get error!"); + } + + switch (temp) + { + case "BEGIN": + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin; + case "CENTER": + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignCenter; + case "END": + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignEnd; + default: + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin; + } } set { - SetProperty(TextEditor.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin: + { + valueToString = "BEGIN"; + break; + } + case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignCenter: + { + valueToString = "CENTER"; + break; + } + case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignEnd: + { + valueToString = "END"; + break; + } + default: + { + valueToString = "BEGIN"; + break; + } + } + SetProperty(TextEditor.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); } } diff --git a/Tizen.NUI/src/public/TextField.cs b/Tizen.NUI/src/public/TextField.cs index f6f0496..6bfe9d8 100755 --- a/Tizen.NUI/src/public/TextField.cs +++ b/Tizen.NUI/src/public/TextField.cs @@ -594,34 +594,110 @@ namespace Tizen.NUI /// /// HorizontalAlignment property. /// - public string HorizontalAlignment + public Tizen.NUI.Constants.HorizontalAlignment HorizontalAlignment { get { string temp; - GetProperty(TextField.Property.HORIZONTAL_ALIGNMENT).Get(out temp); - return temp; + if (GetProperty(TextField.Property.HORIZONTAL_ALIGNMENT).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "HorizontalAlignment get error!"); + } + + switch (temp) + { + case "BEGIN": + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin; + case "CENTER": + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignCenter; + case "END": + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignEnd; + default: + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin; + } } set { - SetProperty(TextField.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin: + { + valueToString = "BEGIN"; + break; + } + case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignCenter: + { + valueToString = "CENTER"; + break; + } + case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignEnd: + { + valueToString = "END"; + break; + } + default: + { + valueToString = "BEGIN"; + break; + } + } + SetProperty(TextField.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); } } /// /// VerticalAlignment property. /// - public string VerticalAlignment + public Tizen.NUI.Constants.VerticalAlignment VerticalAlignment { get { string temp; - GetProperty(TextField.Property.VERTICAL_ALIGNMENT).Get(out temp); - return temp; + if (GetProperty(TextField.Property.VERTICAL_ALIGNMENT).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "VerticalAlignment get error!"); + } + + switch (temp) + { + case "TOP": + return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignTop; + case "CENTER": + return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignCenter; + case "BOTTOM": + return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom; + default: + return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom; + } } set { - SetProperty(TextField.Property.VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignTop: + { + valueToString = "TOP"; + break; + } + case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignCenter: + { + valueToString = "CENTER"; + break; + } + case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom: + { + valueToString = "BOTTOM"; + break; + } + default: + { + valueToString = "BOTTOM"; + break; + } + } + SetProperty(TextField.Property.VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); } } diff --git a/Tizen.NUI/src/public/TextLabel.cs b/Tizen.NUI/src/public/TextLabel.cs index bef9af1..adf4d72 100755 --- a/Tizen.NUI/src/public/TextLabel.cs +++ b/Tizen.NUI/src/public/TextLabel.cs @@ -307,17 +307,54 @@ namespace Tizen.NUI /// HorizontalAlignment property.
/// The line horizontal alignment.
///
- public string HorizontalAlignment + public Tizen.NUI.Constants.HorizontalAlignment HorizontalAlignment { get { string temp; - GetProperty(TextLabel.Property.HORIZONTAL_ALIGNMENT).Get(out temp); - return temp; + if (GetProperty(TextLabel.Property.HORIZONTAL_ALIGNMENT).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "HorizontalAlignment get error!"); + } + switch (temp) + { + case "BEGIN": + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin; + case "CENTER": + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignCenter; + case "END": + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignEnd; + default: + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin; + } } set { - SetProperty(TextLabel.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin: + { + valueToString = "BEGIN"; + break; + } + case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignCenter: + { + valueToString = "CENTER"; + break; + } + case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignEnd: + { + valueToString = "END"; + break; + } + default: + { + valueToString = "BEGIN"; + break; + } + } + SetProperty(TextLabel.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); } } @@ -325,17 +362,55 @@ namespace Tizen.NUI /// VerticalAlignment property.
/// The line vertical alignment.
///
- public string VerticalAlignment + public Tizen.NUI.Constants.VerticalAlignment VerticalAlignment { get { string temp; - GetProperty(TextLabel.Property.VERTICAL_ALIGNMENT).Get(out temp); - return temp; + if (GetProperty(TextLabel.Property.VERTICAL_ALIGNMENT).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "VerticalAlignment get error!"); + } + + switch (temp) + { + case "TOP": + return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignTop; + case "CENTER": + return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignCenter; + case "BOTTOM": + return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom; + default: + return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom; + } } set { - SetProperty(TextLabel.Property.VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignTop: + { + valueToString = "TOP"; + break; + } + case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignCenter: + { + valueToString = "CENTER"; + break; + } + case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom: + { + valueToString = "BOTTOM"; + break; + } + default: + { + valueToString = "BOTTOM"; + break; + } + } + SetProperty(TextLabel.Property.VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); } } @@ -629,4 +704,42 @@ namespace Tizen.NUI } + /// + /// Enumeration for the text horizontal aligning. + /// + public enum HorizontalAlignment + { + /// + /// Texts place at the begin of horizontal direction. + /// + HorizontalAlignBegin, + /// + /// Texts place at the center of horizontal direction. + /// + HorizontalAlignCenter, + /// + /// Texts place at the end of horizontal direction. + /// + HorizontalAlignEnd + } + + /// + /// Enumeration for the text horizontal aligning. + /// + public enum VerticalAlignment + { + /// + /// Texts place at the top of vertical direction. + /// + VerticalAlignTop, + /// + /// Texts place at the center of vertical direction. + /// + VerticalAlignCenter, + /// + /// Texts place at the bottom of vertical direction. + /// + VerticalAlignBottom + } + } diff --git a/Tizen.NUI/src/public/View.cs b/Tizen.NUI/src/public/View.cs index 42bd8da..385ba60 100755 --- a/Tizen.NUI/src/public/View.cs +++ b/Tizen.NUI/src/public/View.cs @@ -956,52 +956,92 @@ namespace Tizen.NUI /// /// The current state of the view. /// - public string State + public States State { get { int temp = 0; - GetProperty(View.Property.STATE).Get(ref temp); + if (GetProperty(View.Property.STATE).Get(ref temp) == false) + { + //Tizen.Log.Error("NUI", "State get error!"); + } switch (temp) { case 0: { - return "NORMAL"; + return States.Normal; } case 1: { - return "FOCUSED"; + return States.Focused; } case 2: { - return "DISABLED"; + return States.Disabled; } default: { - return ""; + return States.Normal; } } } set { - SetProperty(View.Property.STATE, new Tizen.NUI.PropertyValue(value)); + SetProperty(View.Property.STATE, new Tizen.NUI.PropertyValue((int)value)); } } /// /// The current sub state of the view. /// - public string SubState + public States SubState { get { string temp; - GetProperty(View.Property.SUB_STATE).Get(out temp); - return temp; + if (GetProperty(View.Property.SUB_STATE).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "subState get error!"); + } + switch (temp) + { + case "NORMAL": + return States.Normal; + case "FOCUSED": + return States.Focused; + case "DISABLED": + return States.Disabled; + default: + return States.Normal; + } } set { - SetProperty(View.Property.SUB_STATE, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case States.Normal: + { + valueToString = "NORMAL"; + break; + } + case States.Focused: + { + valueToString = "FOCUSED"; + break; + } + case States.Disabled: + { + valueToString = "DISABLED"; + break; + } + default: + { + valueToString = "NORMAL"; + break; + } + } + SetProperty(View.Property.SUB_STATE, new Tizen.NUI.PropertyValue(valueToString)); } } @@ -1198,34 +1238,110 @@ namespace Tizen.NUI /// /// The horizontal alignment of this child inside the cells, if not set, default value is 'left' /// - public string CellHorizontalAlignment + public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment { get { string temp; - GetProperty(TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT).Get(out temp); - return temp; + if (GetProperty(TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT).Get(out temp) == false) + { + //Tizen.Log.Error("NUI", "CellHorizontalAlignment get error!"); + } + + switch (temp) + { + case "left": + return Tizen.NUI.HorizontalAlignmentType.Left; + case "center": + return Tizen.NUI.HorizontalAlignmentType.Center; + case "right": + return Tizen.NUI.HorizontalAlignmentType.Right; + default: + return Tizen.NUI.HorizontalAlignmentType.Left; + } } set { - SetProperty(TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case Tizen.NUI.HorizontalAlignmentType.Left: + { + valueToString = "left"; + break; + } + case Tizen.NUI.HorizontalAlignmentType.Center: + { + valueToString = "center"; + break; + } + case Tizen.NUI.HorizontalAlignmentType.Right: + { + valueToString = "right"; + break; + } + default: + { + valueToString = "left"; + break; + } + } + SetProperty(TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); } } /// /// The vertical alignment of this child inside the cells, if not set, default value is 'top' /// - public string CellVerticalAlignment + public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment { get { string temp; GetProperty(TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT).Get(out temp); - return temp; + { + //Tizen.Log.Error("NUI", "CellVerticalAlignment get error!"); + } + + switch (temp) + { + case "top": + return Tizen.NUI.VerticalAlignmentType.Top; + case "center": + return Tizen.NUI.VerticalAlignmentType.Center; + case "bottom": + return Tizen.NUI.VerticalAlignmentType.Bottom; + default: + return Tizen.NUI.VerticalAlignmentType.Top; + } } set { - SetProperty(TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(value)); + string valueToString = ""; + switch (value) + { + case Tizen.NUI.VerticalAlignmentType.Top: + { + valueToString = "top"; + break; + } + case Tizen.NUI.VerticalAlignmentType.Center: + { + valueToString = "center"; + break; + } + case Tizen.NUI.VerticalAlignmentType.Bottom: + { + valueToString = "bottom"; + break; + } + default: + { + valueToString = "top"; + break; + } + } + SetProperty(TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); } } @@ -1332,6 +1448,24 @@ namespace Tizen.NUI } } + /// + /// Enumeration for describing the states of view. + /// + public enum States + { + /// + /// Normal state + /// + Normal, + /// + /// Focused state + /// + Focused, + /// + /// Disabled state + /// + Disabled + } } } diff --git a/Tizen.NUI/src/public/VisualMaps.cs b/Tizen.NUI/src/public/VisualMaps.cs index 143c889..e16ea3c 100755 --- a/Tizen.NUI/src/public/VisualMaps.cs +++ b/Tizen.NUI/src/public/VisualMaps.cs @@ -555,15 +555,47 @@ namespace Tizen.NUI /// Get or set the line horizontal alignment.
/// If not specified, the default is BEGIN.
///
- public string HorizontalAlignment - { - get - { - return _horizontalAlignment; - } - set - { - _horizontalAlignment = value; + public Tizen.NUI.Constants.HorizontalAlignment HorizontalAlignment + { + get + { + switch (_horizontalAlignment) + { + case "BEGIN": + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin; + case "CENTER": + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignCenter; + case "END": + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignEnd; + default: + return Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin; + } + } + set + { + switch (value) + { + case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignBegin: + { + _horizontalAlignment = "BEGIN"; + break; + } + case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignCenter: + { + _horizontalAlignment = "CENTER"; + break; + } + case Tizen.NUI.Constants.HorizontalAlignment.HorizontalAlignEnd: + { + _horizontalAlignment = "END"; + break; + } + default: + { + _horizontalAlignment = "BEGIN"; + break; + } + } UpdateVisual(); } } @@ -572,15 +604,47 @@ namespace Tizen.NUI /// Get or set the line vertical alignment.
/// If not specified, the default is TOP.
///
- public string VerticalAlignment - { - get - { - return _verticalAlignment; - } - set - { - _verticalAlignment = value; + public Tizen.NUI.Constants.VerticalAlignment VerticalAlignment + { + get + { + switch (_verticalAlignment) + { + case "TOP": + return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignTop; + case "CENTER": + return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignCenter; + case "BOTTOM": + return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom; + default: + return Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom; + } + } + set + { + switch (value) + { + case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignTop: + { + _verticalAlignment = "TOP"; + break; + } + case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignCenter: + { + _verticalAlignment = "CENTER"; + break; + } + case Tizen.NUI.Constants.VerticalAlignment.VerticalAlignBottom: + { + _verticalAlignment = "BOTTOM"; + break; + } + default: + { + _verticalAlignment = "TOP"; + break; + } + } UpdateVisual(); } } -- 2.7.4