From f522e5456f5d27148b7ef063eb012073f8bd2870 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 --- src/Tizen.NUI/src/public/Button.cs | 75 +++++++++- src/Tizen.NUI/src/public/CameraActor.cs | 76 +++++++++- src/Tizen.NUI/src/public/CustomView/Spin.cs | 4 +- src/Tizen.NUI/src/public/CustomView/VisualView.cs | 2 +- src/Tizen.NUI/src/public/Popup.cs | 163 +++++++++++++++++++-- src/Tizen.NUI/src/public/PushButton.cs | 79 +++++++++- src/Tizen.NUI/src/public/ScrollBar.cs | 78 +++++++++- src/Tizen.NUI/src/public/TextEditor.cs | 46 +++++- src/Tizen.NUI/src/public/TextField.cs | 92 +++++++++++- src/Tizen.NUI/src/public/TextLabel.cs | 129 +++++++++++++++- src/Tizen.NUI/src/public/View.cs | 170 +++++++++++++++++++--- src/Tizen.NUI/src/public/VisualMaps.cs | 100 ++++++++++--- 12 files changed, 919 insertions(+), 95 deletions(-) diff --git a/src/Tizen.NUI/src/public/Button.cs b/src/Tizen.NUI/src/public/Button.cs index 0964c4a..1202d09 100755 --- a/src/Tizen.NUI/src/public/Button.cs +++ b/src/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/src/Tizen.NUI/src/public/CameraActor.cs b/src/Tizen.NUI/src/public/CameraActor.cs index 57f1af9..3f5f16a 100755 --- a/src/Tizen.NUI/src/public/CameraActor.cs +++ b/src/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/src/Tizen.NUI/src/public/CustomView/Spin.cs b/src/Tizen.NUI/src/public/CustomView/Spin.cs index 4fe2bcd..efa4161 100755 --- a/src/Tizen.NUI/src/public/CustomView/Spin.cs +++ b/src/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/src/Tizen.NUI/src/public/CustomView/VisualView.cs b/src/Tizen.NUI/src/public/CustomView/VisualView.cs index 82684a7..f43bceb 100755 --- a/src/Tizen.NUI/src/public/CustomView/VisualView.cs +++ b/src/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/src/Tizen.NUI/src/public/Popup.cs b/src/Tizen.NUI/src/public/Popup.cs index f9f3c4e..3b69235 100755 --- a/src/Tizen.NUI/src/public/Popup.cs +++ b/src/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/src/Tizen.NUI/src/public/PushButton.cs b/src/Tizen.NUI/src/public/PushButton.cs index 4a22ce2..ef75431 100755 --- a/src/Tizen.NUI/src/public/PushButton.cs +++ b/src/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/src/Tizen.NUI/src/public/ScrollBar.cs b/src/Tizen.NUI/src/public/ScrollBar.cs index fb93738..045e1a0 100755 --- a/src/Tizen.NUI/src/public/ScrollBar.cs +++ b/src/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/src/Tizen.NUI/src/public/TextEditor.cs b/src/Tizen.NUI/src/public/TextEditor.cs index bb48788..a9e78b9 100755 --- a/src/Tizen.NUI/src/public/TextEditor.cs +++ b/src/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/src/Tizen.NUI/src/public/TextField.cs b/src/Tizen.NUI/src/public/TextField.cs index f6f0496..6bfe9d8 100755 --- a/src/Tizen.NUI/src/public/TextField.cs +++ b/src/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/src/Tizen.NUI/src/public/TextLabel.cs b/src/Tizen.NUI/src/public/TextLabel.cs index bef9af1..adf4d72 100755 --- a/src/Tizen.NUI/src/public/TextLabel.cs +++ b/src/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/src/Tizen.NUI/src/public/View.cs b/src/Tizen.NUI/src/public/View.cs index 42bd8da..385ba60 100755 --- a/src/Tizen.NUI/src/public/View.cs +++ b/src/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/src/Tizen.NUI/src/public/VisualMaps.cs b/src/Tizen.NUI/src/public/VisualMaps.cs index 143c889..e16ea3c 100755 --- a/src/Tizen.NUI/src/public/VisualMaps.cs +++ b/src/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