X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FBaseComponents%2FTextEditor.cs;h=e4fd298600de61a0974fef029f6cb4d395e3ec5c;hb=7210a4d9f09f13de444cabcdc69998744a9c19f0;hp=9f3e819d49ddb44e345cfeb77ba9138216d39476;hpb=2efd383257db631ea6f5570c0b093cbefb2473e1;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git
diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
index 9f3e819..e4fd298 100755
--- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
+++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs
@@ -1,31 +1,40 @@
-/** 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.
+ *
+ */
+
+extern alias TizenSystemSettings;
+using TizenSystemSettings.Tizen.System;
+
+using System;
+using System.Runtime.InteropServices;
+using System.Globalization;
+using System.ComponentModel;
namespace Tizen.NUI.BaseComponents
{
-
- using System;
- using System.Runtime.InteropServices;
-
///
/// A control which provides a multi-line editable text editor.
///
+ /// 3
public class TextEditor : View
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+ private string textEditorTextSid = null;
+ private string textEditorPlaceHolderTextSid = null;
+ private bool systemlangTextFlag = false;
internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextEditor_SWIGUpcast(cPtr), cMemoryOwn)
{
@@ -40,6 +49,7 @@ namespace Tizen.NUI.BaseComponents
///
/// Dispose.
///
+ /// 3
protected override void Dispose(DisposeTypes type)
{
if (disposed)
@@ -77,8 +87,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Event arguments that passed via TextChanged signal.
+ /// Event arguments that passed via the TextChanged signal.
///
+ /// 3
public class TextChangedEventArgs : EventArgs
{
private TextEditor _textEditor;
@@ -86,6 +97,7 @@ namespace Tizen.NUI.BaseComponents
///
/// TextEditor - is the texteditor control which has the text contents changed.
///
+ /// 3
public TextEditor TextEditor
{
get
@@ -105,9 +117,10 @@ namespace Tizen.NUI.BaseComponents
private TextChangedCallbackDelegate _textEditorTextChangedCallbackDelegate;
///
- /// Event for TextChanged signal which can be used to subscribe/unsubscribe the event handler
- /// provided by the user. TextChanged signal is emitted when the text changes.
+ /// An event for the TextChanged signal which can be used to subscribe or unsubscribe the event handler
+ /// provided by the user. The TextChanged signal is emitted when the text changes.
///
+ /// 3
public event EventHandler TextChanged
{
add
@@ -145,8 +158,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Event arguments that passed via ScrollStateChanged signal.
+ /// Event arguments that passed via the ScrollStateChanged signal.
///
+ /// 3
public class ScrollStateChangedEventArgs : EventArgs
{
private TextEditor _textEditor;
@@ -155,6 +169,7 @@ namespace Tizen.NUI.BaseComponents
///
/// TextEditor - is the texteditor control which has the scroll state changed.
///
+ /// 3
public TextEditor TextEditor
{
get
@@ -170,6 +185,7 @@ namespace Tizen.NUI.BaseComponents
///
/// ScrollState - is the texteditor control scroll state.
///
+ /// 3
public ScrollState ScrollState
{
get
@@ -189,9 +205,10 @@ namespace Tizen.NUI.BaseComponents
private ScrollStateChangedCallbackDelegate _textEditorScrollStateChangedCallbackDelegate;
///
- /// Event for ScrollStateChanged signal which can be used to subscribe/unsubscribe the event handler
- /// provided by the user. ScrollStateChanged signal is emitted when the scroll state changes.
+ /// Event for the ScrollStateChanged signal which can be used to subscribe or unsubscribe the event handler
+ /// provided by the user. The ScrollStateChanged signal is emitted when the scroll state changes.
///
+ /// 3
public event EventHandler ScrollStateChanged
{
add
@@ -231,7 +248,7 @@ namespace Tizen.NUI.BaseComponents
}
}
- internal class Property
+ internal new class Property
{
internal static readonly int RENDERING_BACKEND = NDalicPINVOKE.TextEditor_Property_RENDERING_BACKEND_get();
internal static readonly int TEXT = NDalicPINVOKE.TextEditor_Property_TEXT_get();
@@ -307,6 +324,7 @@ namespace Tizen.NUI.BaseComponents
///
/// Creates the TextEditor control.
///
+ /// 3
public TextEditor() : this(NDalicPINVOKE.TextEditor_New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
@@ -317,7 +335,16 @@ namespace Tizen.NUI.BaseComponents
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- [Obsolete("Please do not use! this will be deprecated")]
+ ///
+ /// Downcasts a handle to textEditor handle.
+ ///
+ ///
+ ///
+ /// 3
+ /// Please do not use! this will be deprecated!
+ /// Instead please use as keyword.
+ [Obsolete("Please DO NOT use! This will be deprecated, instead please USE as keyword.")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
public new static TextEditor DownCast(BaseHandle handle)
{
TextEditor ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextEditor;
@@ -347,8 +374,87 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Text property.
+ /// The TranslatableText property.
+ /// The text can set the SID value.
+ ///
+ ///
+ /// ResourceManager about multilingual is null.
+ ///
+ /// 4
+ public string TranslatableText
+ {
+ get
+ {
+ return textEditorTextSid;
+ }
+ set
+ {
+ if (NUIApplication.MultilingualResourceManager == null)
+ {
+ throw new ArgumentNullException("ResourceManager about multilingual is null");
+ }
+ textEditorTextSid = value;
+ Text = SetTranslatable(textEditorTextSid);
+ }
+ }
+ ///
+ /// The TranslatablePlaceholderText property.
+ /// The text can set the SID value.
+ ///
+ ///
+ /// ResourceManager about multilingual is null.
+ ///
+ /// 4
+ public string TranslatablePlaceholderText
+ {
+ get
+ {
+ return textEditorPlaceHolderTextSid;
+ }
+ set
+ {
+ if (NUIApplication.MultilingualResourceManager == null)
+ {
+ throw new ArgumentNullException("ResourceManager about multilingual is null");
+ }
+ textEditorPlaceHolderTextSid = value;
+ PlaceholderText = SetTranslatable(textEditorPlaceHolderTextSid);
+ }
+ }
+ private string SetTranslatable(string textEditorSid)
+ {
+ string translatableText = null;
+ translatableText = NUIApplication.MultilingualResourceManager?.GetString(textEditorSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-")));
+ if (translatableText != null)
+ {
+ if (systemlangTextFlag == false)
+ {
+ SystemSettings.LocaleLanguageChanged += new WeakEventHandler(SystemSettings_LocaleLanguageChanged).Handler;
+ systemlangTextFlag = true;
+ }
+ return translatableText;
+ }
+ else
+ {
+ translatableText = "";
+ return translatableText;
+ }
+ }
+ private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e)
+ {
+ if (textEditorTextSid != null)
+ {
+ Text = NUIApplication.MultilingualResourceManager?.GetString(textEditorTextSid, new CultureInfo(e.Value.Replace("_", "-")));
+ }
+ if (textEditorPlaceHolderTextSid != null)
+ {
+ PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
+ }
+ }
+ ///
+ /// The Text property.
///
+ /// 3
public string Text
{
get
@@ -364,8 +470,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Text color property.
+ /// The TextColor property.
///
+ /// 3
public Vector4 TextColor
{
get
@@ -381,8 +488,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Font family property.
+ /// The FontFamily property.
///
+ /// 3
public string FontFamily
{
get
@@ -398,8 +506,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Font style property.
+ /// The FontStyle property.
///
+ /// 3
public PropertyMap FontStyle
{
get
@@ -415,8 +524,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Point size property.
+ /// The PointSize property.
///
+ /// 3
public float PointSize
{
get
@@ -432,8 +542,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Horizontal alignment property.
+ /// The HorizontalAlignment property.
///
+ /// 3
public HorizontalAlignment HorizontalAlignment
{
get
@@ -487,8 +598,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Scroll threshold property.
+ /// The ScrollThreshold property.
///
+ /// 3
public float ScrollThreshold
{
get
@@ -504,8 +616,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Scroll speed property.
+ /// The ScrollSpeed property.
///
+ /// 3
public float ScrollSpeed
{
get
@@ -521,8 +634,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Primary cursor color property.
+ /// The PrimaryCursorColor property.
///
+ /// 3
public Vector4 PrimaryCursorColor
{
get
@@ -538,8 +652,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// SecondaryCursorColor property.
+ /// The SecondaryCursorColor property.
///
+ /// 3
public Vector4 SecondaryCursorColor
{
get
@@ -555,8 +670,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// EnableCursorBlink property.
+ /// The EnableCursorBlink property.
///
+ /// 3
public bool EnableCursorBlink
{
get
@@ -572,8 +688,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// CursorBlinkInterval property.
+ /// The CursorBlinkInterval property.
///
+ /// 3
public float CursorBlinkInterval
{
get
@@ -589,8 +706,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// CursorBlinkDuration property.
+ /// The CursorBlinkDuration property.
///
+ /// 3
public float CursorBlinkDuration
{
get
@@ -606,8 +724,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// CursorWidth property.
+ /// The CursorWidth property.
///
+ /// 3
public int CursorWidth
{
get
@@ -623,8 +742,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// GrabHandleImage property.
+ /// The GrabHandleImage property.
///
+ /// 3
public string GrabHandleImage
{
get
@@ -640,8 +760,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// GrabHandlePressedImage property.
+ /// The GrabHandlePressedImage property.
///
+ /// 3
public string GrabHandlePressedImage
{
get
@@ -657,8 +778,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// SelectionHandleImageLeft property.
+ /// The SelectionHandleImageLeft property.
///
+ /// 3
public PropertyMap SelectionHandleImageLeft
{
get
@@ -674,8 +796,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// SelectionHandleImageRight property.
+ /// The SelectionHandleImageRight property.
///
+ /// 3
public PropertyMap SelectionHandleImageRight
{
get
@@ -691,8 +814,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// SelectionHandlePressedImageLeft property.
+ /// The SelectionHandlePressedImageLeft property.
///
+ /// 3
public PropertyMap SelectionHandlePressedImageLeft
{
get
@@ -708,8 +832,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// SelectionHandlePressedImageRight property.
+ /// The SelectionHandlePressedImageRight property.
///
+ /// 3
public PropertyMap SelectionHandlePressedImageRight
{
get
@@ -725,8 +850,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// SelectionHandleMarkerImageLeft property.
+ /// The SelectionHandleMarkerImageLeft property.
///
+ /// 3
public PropertyMap SelectionHandleMarkerImageLeft
{
get
@@ -742,8 +868,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// SelectionHandleMarkerImageRight property.
+ /// The SelectionHandleMarkerImageRight property.
///
+ /// 3
public PropertyMap SelectionHandleMarkerImageRight
{
get
@@ -759,8 +886,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// SelectionHighlightColor property.
+ /// The SelectionHighlightColor property.
///
+ /// 3
public Vector4 SelectionHighlightColor
{
get
@@ -776,8 +904,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// DecorationBoundingBox property.
+ /// The DecorationBoundingBox property.
///
+ /// 3
public Rectangle DecorationBoundingBox
{
get
@@ -793,8 +922,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// EnableMarkup property.
+ /// The EnableMarkup property.
///
+ /// 3
public bool EnableMarkup
{
get
@@ -810,8 +940,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// InputColor property.
+ /// The InputColor property.
///
+ /// 3
public Vector4 InputColor
{
get
@@ -827,8 +958,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// InputFontFamily property.
+ /// The InputFontFamily property.
///
+ /// 3
public string InputFontFamily
{
get
@@ -844,8 +976,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// InputFontStyle property.
+ /// The InputFontStyle property.
///
+ /// 3
public PropertyMap InputFontStyle
{
get
@@ -861,8 +994,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// InputPointSize property.
+ /// The InputPointSize property.
///
+ /// 3
public float InputPointSize
{
get
@@ -878,8 +1012,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// LineSpacing property.
+ /// The LineSpacing property.
///
+ /// 3
public float LineSpacing
{
get
@@ -895,8 +1030,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// InputLineSpacing property.
+ /// The InputLineSpacing property.
///
+ /// 3
public float InputLineSpacing
{
get
@@ -912,8 +1048,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Underline property.
+ /// The Underline property.
///
+ /// 3
public PropertyMap Underline
{
get
@@ -929,8 +1066,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// InputUnderline property.
+ /// The InputUnderline property.
///
+ /// 3
public string InputUnderline
{
get
@@ -946,8 +1084,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Shadow property.
+ /// The Shadow property.
///
+ /// 3
public PropertyMap Shadow
{
get
@@ -963,8 +1102,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// InputShadow property.
+ /// The InputShadow property.
///
+ /// 3
public string InputShadow
{
get
@@ -980,8 +1120,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Emboss property.
+ /// The Emboss property.
///
+ /// 3
public string Emboss
{
get
@@ -997,8 +1138,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// InputEmboss property.
+ /// The InputEmboss property.
///
+ /// 3
public string InputEmboss
{
get
@@ -1014,14 +1156,15 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Outline property.
+ /// The Outline property.
///
- public string Outline
+ /// 3
+ public PropertyMap Outline
{
get
{
- string temp;
- GetProperty(TextEditor.Property.OUTLINE).Get(out temp);
+ PropertyMap temp = new PropertyMap();
+ GetProperty(TextEditor.Property.OUTLINE).Get(temp);
return temp;
}
set
@@ -1031,8 +1174,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// InputOutline property.
+ /// The InputOutline property.
///
+ /// 3
public string InputOutline
{
get
@@ -1048,8 +1192,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// SmoothScroll property.
+ /// The SmoothScroll property.
///
+ /// 3
public bool SmoothScroll
{
get
@@ -1065,8 +1210,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// SmoothScrollDuration property.
+ /// The SmoothScrollDuration property.
///
+ /// 3
public float SmoothScrollDuration
{
get
@@ -1082,8 +1228,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// EnableScrollBar property.
+ /// The EnableScrollBar property.
///
+ /// 3
public bool EnableScrollBar
{
get
@@ -1099,8 +1246,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// ScrollBarShowDuration property.
+ /// The ScrollBarShowDuration property.
///
+ /// 3
public float ScrollBarShowDuration
{
get
@@ -1116,8 +1264,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// ScrollBarFadeDuration property.
+ /// The ScrollBarFadeDuration property.
///
+ /// 3
public float ScrollBarFadeDuration
{
get
@@ -1133,8 +1282,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// PixelSize property.
+ /// The PixelSize property.
///
+ /// 3
public float PixelSize
{
get
@@ -1150,8 +1300,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// The line count of text.
+ /// The line count of the text.
///
+ /// 3
public int LineCount
{
get
@@ -1165,6 +1316,7 @@ namespace Tizen.NUI.BaseComponents
///
/// The text to display when the TextEditor is empty and inactive.
///
+ /// 3
public string PlaceholderText
{
get
@@ -1180,8 +1332,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// The placeholder-text color.
+ /// The Placeholder text color.
///
+ /// 3
public Color PlaceholderTextColor
{
get
@@ -1197,8 +1350,9 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Enable selection property.
+ /// The EnableSelection property.
///
+ /// 3
public bool EnableSelection
{
get
@@ -1214,29 +1368,30 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// Placeholder property.
- /// Gets/Sets the placeholder : text, color, font family, font style, point size, and pixel size.
+ /// The Placeholder property.
+ /// Gets or sets the placeholder: text, color, font family, font style, point size, and pixel size.
///
///
/// The following example demonstrates how to set the placeholder property.
///
/// PropertyMap propertyMap = new PropertyMap();
- /// propertyMap.Add("placeholderText", new PropertyValue("Setting Placeholder Text"));
- /// propertyMap.Add("placeholderTextFocused", new PropertyValue("Setting Placeholder Text Focused"));
- /// propertyMap.Add("placeholderColor", new PropertyValue(Color.Red));
- /// propertyMap.Add("placeholderFontFamily", new PropertyValue("Arial"));
- /// propertyMap.Add("placeholderPointSize", new PropertyValue(12.0f));
+ /// propertyMap.Add("text", new PropertyValue("Setting Placeholder Text"));
+ /// propertyMap.Add("textFocused", new PropertyValue("Setting Placeholder Text Focused"));
+ /// propertyMap.Add("color", new PropertyValue(Color.Red));
+ /// propertyMap.Add("fontFamily", new PropertyValue("Arial"));
+ /// propertyMap.Add("pointSize", new PropertyValue(12.0f));
///
/// PropertyMap fontStyleMap = new PropertyMap();
/// fontStyleMap.Add("weight", new PropertyValue("bold"));
/// fontStyleMap.Add("width", new PropertyValue("condensed"));
/// fontStyleMap.Add("slant", new PropertyValue("italic"));
- /// propertyMap.Add("placeholderFontStyle", new PropertyValue(fontStyleMap));
+ /// propertyMap.Add("fontStyle", new PropertyValue(fontStyleMap));
///
/// TextEditor editor = new TextEditor();
/// editor.Placeholder = propertyMap;
///
///
+ /// 3
public Tizen.NUI.PropertyMap Placeholder
{
get
@@ -1252,45 +1407,24 @@ namespace Tizen.NUI.BaseComponents
}
///
- /// LineWrapMode property.
- /// line wrap mode when the text lines over layout width.
+ /// The LineWrapMode property.
+ /// The line wrap mode when the text lines over the layout width.
///
+ /// 4
public LineWrapMode LineWrapMode
{
get
{
- string temp;
+ int temp;
if(GetProperty(TextEditor.Property.LINE_WRAP_MODE).Get(out temp) == false)
{
NUILog.Error("LineWrapMode get error!");
}
- switch (temp)
- {
- case "WORD":
- return LineWrapMode.Word;
- case "CHARACTER":
- return LineWrapMode.Character;
- default:
- return LineWrapMode.Word;
- }
+ return (LineWrapMode)temp;
}
set
{
- string temp = "";
- switch (value)
- {
- case LineWrapMode.Word:
- {
- temp = "WORD";
- break;
- }
- case LineWrapMode.Character:
- {
- temp = "CHARACTER";
- break;
- }
- }
- SetProperty(TextEditor.Property.LINE_WRAP_MODE, new Tizen.NUI.PropertyValue(temp));
+ SetProperty(TextEditor.Property.LINE_WRAP_MODE, new Tizen.NUI.PropertyValue((int)value));
}
}