/*
* Copyright(c) 2019 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.Globalization;
using System.ComponentModel;
using Tizen.NUI.Binding;
namespace Tizen.NUI.BaseComponents
{
///
/// A control which provides a single line editable text field.
///
/// 3
public partial class TextField : View
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private string textFieldTextSid = null;
private string textFieldPlaceHolderTextSid = null;
private bool systemlangTextFlag = false;
private InputMethodContext inputMethodCotext = null;
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public TextFieldStyle Style => ViewStyle as TextFieldStyle;
///
/// Creates the TextField control.
///
/// 3
public TextField() : this(Interop.TextField.TextField_New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Creates the TextField with setting the status of shown or hidden.
///
/// false : Not displayed (hidden), true : displayed (shown)
/// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI).
[EditorBrowsable(EditorBrowsableState.Never)]
public TextField(bool shown) : this(Interop.TextField.TextField_New(), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
SetVisible(shown);
}
///
/// Get attribues, it is abstract function and must be override.
///
/// 6
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
protected override ViewStyle GetViewStyle()
{
return new TextFieldStyle();
}
internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, ViewStyle viewStyle, bool shown = true) : base(Interop.TextField.TextField_SWIGUpcast(cPtr), cMemoryOwn, viewStyle)
{
if (!shown)
{
SetVisible(false);
}
}
internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn, bool shown = true) : base(Interop.TextField.TextField_SWIGUpcast(cPtr), cMemoryOwn)
{
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
if (!shown)
{
SetVisible(false);
}
}
internal TextField(TextField handle, bool shown = true) : this(Interop.TextField.new_TextField__SWIG_1(TextField.getCPtr(handle)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
if (!shown)
{
SetVisible(false);
}
}
internal enum ExceedPolicyType
{
ExceedPolicyOriginal,
ExceedPolicyClip
}
///
/// The TranslatableText property.
/// The text can set the SID value.
///
///
/// ResourceManager about multilingual is null.
///
/// 4
public string TranslatableText
{
get
{
return (string)GetValue(TranslatableTextProperty);
}
set
{
SetValue(TranslatableTextProperty, value);
}
}
private string translatableText
{
get
{
return textFieldTextSid;
}
set
{
if (NUIApplication.MultilingualResourceManager == null)
{
throw new ArgumentNullException("ResourceManager about multilingual is null");
}
textFieldTextSid = value;
Text = SetTranslatable(textFieldTextSid);
NotifyPropertyChanged();
}
}
///
/// The TranslatablePlaceholderText property.
/// The text can set the SID value.
///
///
/// ResourceManager about multilingual is null.
///
/// 4
public string TranslatablePlaceholderText
{
get
{
return (string)GetValue(TranslatablePlaceholderTextProperty);
}
set
{
SetValue(TranslatablePlaceholderTextProperty, value);
}
}
private string translatablePlaceholderText
{
get
{
return textFieldPlaceHolderTextSid;
}
set
{
if (NUIApplication.MultilingualResourceManager == null)
{
throw new ArgumentNullException("ResourceManager about multilingual is null");
}
textFieldPlaceHolderTextSid = value;
PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid);
NotifyPropertyChanged();
}
}
///
/// The Text property.
///
/// 3
public string Text
{
get
{
return (string)GetValue(TextProperty);
}
set
{
SetValueAndForceSendChangeSignal(TextProperty, value);
NotifyPropertyChanged();
}
}
///
/// The PlaceholderText property.
///
/// 3
public string PlaceholderText
{
get
{
return (string)GetValue(PlaceholderTextProperty);
}
set
{
SetValue(PlaceholderTextProperty, value);
NotifyPropertyChanged();
}
}
///
/// The PlaceholderTextFocused property.
///
/// 3
public string PlaceholderTextFocused
{
get
{
return (string)GetValue(PlaceholderTextFocusedProperty);
}
set
{
SetValue(PlaceholderTextFocusedProperty, value);
NotifyPropertyChanged();
}
}
///
/// The FontFamily property.
///
/// 3
public string FontFamily
{
get
{
return (string)GetValue(FontFamilyProperty);
}
set
{
SetValue(FontFamilyProperty, value);
NotifyPropertyChanged();
}
}
///
/// The FontStyle property.
///
/// 3
public PropertyMap FontStyle
{
get
{
return (PropertyMap)GetValue(FontStyleProperty);
}
set
{
SetValue(FontStyleProperty, value);
NotifyPropertyChanged();
}
}
///
/// The PointSize property.
///
/// 3
public float PointSize
{
get
{
return (float)GetValue(PointSizeProperty);
}
set
{
SetValue(PointSizeProperty, value);
NotifyPropertyChanged();
}
}
///
/// The MaxLength property.
///
/// 3
public int MaxLength
{
get
{
return (int)GetValue(MaxLengthProperty);
}
set
{
SetValue(MaxLengthProperty, value);
NotifyPropertyChanged();
}
}
///
/// The ExceedPolicy property.
///
/// 3
public int ExceedPolicy
{
get
{
return (int)GetValue(ExceedPolicyProperty);
}
set
{
SetValue(ExceedPolicyProperty, value);
NotifyPropertyChanged();
}
}
///
/// The HorizontalAlignment property.
///
/// 3
public HorizontalAlignment HorizontalAlignment
{
get
{
return (HorizontalAlignment)GetValue(HorizontalAlignmentProperty);
}
set
{
SetValue(HorizontalAlignmentProperty, value);
NotifyPropertyChanged();
}
}
///
/// The VerticalAlignment property.
///
/// 3
public VerticalAlignment VerticalAlignment
{
get
{
return (VerticalAlignment)GetValue(VerticalAlignmentProperty);
}
set
{
SetValue(VerticalAlignmentProperty, value);
NotifyPropertyChanged();
NotifyPropertyChanged();
}
}
///
/// The TextColor property.
///
///
/// The property cascade chaining set is possible. For example, this (textField.TextColor.X = 0.1f;) is possible.
///
/// 3
public Color TextColor
{
get
{
Color temp = (Color)GetValue(TextColorProperty);
return new Color(OnTextColorChanged, temp.R, temp.G, temp.B, temp.A);
}
set
{
SetValue(TextColorProperty, value);
NotifyPropertyChanged();
}
}
///
/// The PlaceholderTextColor property.
///
///
/// The property cascade chaining set is possible. For example, this (textField.PlaceholderTextColor.X = 0.1f;) is possible.
///
/// 3
public Vector4 PlaceholderTextColor
{
get
{
Vector4 temp = (Vector4)GetValue(PlaceholderTextColorProperty);
return new Vector4(OnPlaceholderTextColorChanged, temp.X, temp.Y, temp.Z, temp.W);
}
set
{
SetValue(PlaceholderTextColorProperty, value);
NotifyPropertyChanged();
}
}
///
/// The ShadowOffset property.
///
/// 3
///
/// Deprecated.(API Level 6) Use Shadow instead.
/// The property cascade chaining set is possible. For example, this (textField.ShadowOffset.X = 0.1f;) is possible.
///
[Obsolete("Please do not use this ShadowOffset(Deprecated). Please use Shadow instead.")]
public Vector2 ShadowOffset
{
get
{
PropertyMap map = new PropertyMap();
GetProperty(TextField.Property.SHADOW).Get(map);
Vector2 shadowOffset = new Vector2();
map.Find(TextField.Property.SHADOW, "offset")?.Get(shadowOffset);
return new Vector2(OnShadowOffsetChanged, shadowOffset.X, shadowOffset.Y);
}
set
{
PropertyMap temp = new PropertyMap();
temp.Insert("offset", new PropertyValue(value));
SetValue(ShadowProperty, temp);
NotifyPropertyChanged();
}
}
///
/// The ShadowColor property.
///
/// 3
///
/// Deprecated.(API Level 6) Use Shadow instead.
/// The property cascade chaining set is possible. For example, this (textField.ShadowColor.X = 0.1f;) is possible.
///
[Obsolete("Please do not use this ShadowColor(Deprecated). Please use Shadow instead.")]
public Vector4 ShadowColor
{
get
{
PropertyMap map = new PropertyMap();
GetProperty(TextField.Property.SHADOW).Get(map);
Vector4 shadowColor = new Vector4();
map.Find(TextField.Property.SHADOW, "color")?.Get(shadowColor);
return new Vector4(OnShadowColorChanged, shadowColor.X, shadowColor.Y, shadowColor.Z, shadowColor.W);
}
set
{
PropertyMap temp = new PropertyMap();
temp.Insert("color", new PropertyValue(value));
SetValue(ShadowProperty, temp);
NotifyPropertyChanged();
}
}
///
/// The PrimaryCursorColor property.
///
///
/// The property cascade chaining set is possible. For example, this (textField.PrimaryCursorColor.X = 0.1f;) is possible.
///
/// 3
public Vector4 PrimaryCursorColor
{
get
{
Vector4 temp = (Vector4)GetValue(PrimaryCursorColorProperty);
return new Vector4(OnPrimaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
}
set
{
SetValue(PrimaryCursorColorProperty, value);
NotifyPropertyChanged();
}
}
///
/// The SecondaryCursorColor property.
///
///
/// The property cascade chaining set is possible. For example, this (textField.SecondaryCursorColor.X = 0.1f;) is possible.
///
/// 3
public Vector4 SecondaryCursorColor
{
get
{
Vector4 temp = (Vector4)GetValue(SecondaryCursorColorProperty);
return new Vector4(OnSecondaryCursorColorChanged, temp.X, temp.Y, temp.Z, temp.W);
}
set
{
SetValue(SecondaryCursorColorProperty, value);
NotifyPropertyChanged();
}
}
///
/// The EnableCursorBlink property.
///
/// 3
public bool EnableCursorBlink
{
get
{
return (bool)GetValue(EnableCursorBlinkProperty);
}
set
{
SetValue(EnableCursorBlinkProperty, value);
NotifyPropertyChanged();
}
}
///
/// The CursorBlinkInterval property.
///
/// 3
public float CursorBlinkInterval
{
get
{
return (float)GetValue(CursorBlinkIntervalProperty);
}
set
{
SetValue(CursorBlinkIntervalProperty, value);
NotifyPropertyChanged();
}
}
///
/// The CursorBlinkDuration property.
///
/// 3
public float CursorBlinkDuration
{
get
{
return (float)GetValue(CursorBlinkDurationProperty);
}
set
{
SetValue(CursorBlinkDurationProperty, value);
NotifyPropertyChanged();
}
}
///
/// The CursorWidth property.
///
/// 3
public int CursorWidth
{
get
{
return (int)GetValue(CursorWidthProperty);
}
set
{
SetValue(CursorWidthProperty, value);
NotifyPropertyChanged();
}
}
///
/// The GrabHandleImage property.
///
/// 3
public string GrabHandleImage
{
get
{
return (string)GetValue(GrabHandleImageProperty);
}
set
{
SetValue(GrabHandleImageProperty, value);
NotifyPropertyChanged();
}
}
///
/// The GrabHandlePressedImage property.
///
/// 3
public string GrabHandlePressedImage
{
get
{
return (string)GetValue(GrabHandlePressedImageProperty);
}
set
{
SetValue(GrabHandlePressedImageProperty, value);
NotifyPropertyChanged();
}
}
///
/// The ScrollThreshold property.
///
/// 3
public float ScrollThreshold
{
get
{
return (float)GetValue(ScrollThresholdProperty);
}
set
{
SetValue(ScrollThresholdProperty, value);
NotifyPropertyChanged();
}
}
///
/// The ScrollSpeed property.
///
/// 3
public float ScrollSpeed
{
get
{
return (float)GetValue(ScrollSpeedProperty);
}
set
{
SetValue(ScrollSpeedProperty, value);
NotifyPropertyChanged();
}
}
///
/// The SelectionHandleImageLeft property.
///
/// 3
public PropertyMap SelectionHandleImageLeft
{
get
{
return (PropertyMap)GetValue(SelectionHandleImageLeftProperty);
}
set
{
SetValue(SelectionHandleImageLeftProperty, value);
NotifyPropertyChanged();
}
}
///
/// The SelectionHandleImageRight property.
///
/// 3
public PropertyMap SelectionHandleImageRight
{
get
{
return (PropertyMap)GetValue(SelectionHandleImageRightProperty);
}
set
{
SetValue(SelectionHandleImageRightProperty, value);
NotifyPropertyChanged();
}
}
///
/// The SelectionHandlePressedImageLeft property.
///
/// 3
public PropertyMap SelectionHandlePressedImageLeft
{
get
{
return (PropertyMap)GetValue(SelectionHandlePressedImageLeftProperty);
}
set
{
SetValue(SelectionHandlePressedImageLeftProperty, value);
NotifyPropertyChanged();
}
}
///
/// The SelectionHandlePressedImageRight property.
///
/// 3
public PropertyMap SelectionHandlePressedImageRight
{
get
{
return (PropertyMap)GetValue(SelectionHandlePressedImageRightProperty);
}
set
{
SetValue(SelectionHandlePressedImageRightProperty, value);
NotifyPropertyChanged();
}
}
///
/// The SelectionHandleMarkerImageLeft property.
///
/// 3
public PropertyMap SelectionHandleMarkerImageLeft
{
get
{
return (PropertyMap)GetValue(SelectionHandleMarkerImageLeftProperty);
}
set
{
SetValue(SelectionHandleMarkerImageLeftProperty, value);
NotifyPropertyChanged();
}
}
///
/// The SelectionHandleMarkerImageRight property.
///
/// 3
public PropertyMap SelectionHandleMarkerImageRight
{
get
{
return (PropertyMap)GetValue(SelectionHandleMarkerImageRightProperty);
}
set
{
SetValue(SelectionHandleMarkerImageRightProperty, value);
NotifyPropertyChanged();
}
}
///
/// The SelectionHighlightColor property.
///
///
/// The property cascade chaining set is possible. For example, this (textField.SelectionHighlightColor.X = 0.1f;) is possible.
///
/// 3
public Vector4 SelectionHighlightColor
{
get
{
Vector4 temp = (Vector4)GetValue(SelectionHighlightColorProperty);
return new Vector4(OnSelectionHighlightColorChanged, temp.X, temp.Y, temp.Z, temp.W);
}
set
{
SetValue(SelectionHighlightColorProperty, value);
NotifyPropertyChanged();
}
}
///
/// The DecorationBoundingBox property.
///
///
/// The property cascade chaining set is possible. For example, this (textField.DecorationBoundingBox.X = 0.1f;) is possible.
///
/// 3
public Rectangle DecorationBoundingBox
{
get
{
Rectangle temp = (Rectangle)GetValue(DecorationBoundingBoxProperty);
return new Rectangle(OnDecorationBoundingBoxChanged, temp.X, temp.Y, temp.Width, temp.Height);
}
set
{
SetValue(DecorationBoundingBoxProperty, value);
NotifyPropertyChanged();
}
}
///
/// The InputMethodSettings property.
///
/// 3
public PropertyMap InputMethodSettings
{
get
{
return (PropertyMap)GetValue(InputMethodSettingsProperty);
}
set
{
SetValue(InputMethodSettingsProperty, value);
NotifyPropertyChanged();
}
}
///
/// The InputColor property.
///
///
/// The property cascade chaining set is possible. For example, this (textField.InputColor.X = 0.1f;) is possible.
///
/// 3
public Vector4 InputColor
{
get
{
Vector4 temp = (Vector4)GetValue(InputColorProperty);
return new Vector4(OnInputColorChanged, temp.X, temp.Y, temp.Z, temp.W);
}
set
{
SetValue(InputColorProperty, value);
NotifyPropertyChanged();
}
}
///
/// The EnableMarkup property.
///
/// 3
public bool EnableMarkup
{
get
{
return (bool)GetValue(EnableMarkupProperty);
}
set
{
SetValue(EnableMarkupProperty, value);
NotifyPropertyChanged();
}
}
///
/// The InputFontFamily property.
///
/// 3
public string InputFontFamily
{
get
{
return (string)GetValue(InputFontFamilyProperty);
}
set
{
SetValue(InputFontFamilyProperty, value);
NotifyPropertyChanged();
}
}
///
/// The InputFontStyle property.
///
/// 3
public PropertyMap InputFontStyle
{
get
{
return (PropertyMap)GetValue(InputFontStyleProperty);
}
set
{
SetValue(InputFontStyleProperty, value);
NotifyPropertyChanged();
}
}
///
/// The InputPointSize property.
///
/// 3
public float InputPointSize
{
get
{
return (float)GetValue(InputPointSizeProperty);
}
set
{
SetValue(InputPointSizeProperty, value);
NotifyPropertyChanged();
}
}
///
/// The Underline property.
///
/// 3
public PropertyMap Underline
{
get
{
return (PropertyMap)GetValue(UnderlineProperty);
}
set
{
SetValue(UnderlineProperty, value);
NotifyPropertyChanged();
}
}
///
/// The InputUnderline property.
///
/// 3
public string InputUnderline
{
get
{
return (string)GetValue(InputUnderlineProperty);
}
set
{
SetValue(InputUnderlineProperty, value);
NotifyPropertyChanged();
}
}
///
/// The Shadow property.
///
/// 3
public PropertyMap Shadow
{
get
{
return (PropertyMap)GetValue(ShadowProperty);
}
set
{
SetValue(ShadowProperty, value);
NotifyPropertyChanged();
}
}
///
/// The InputShadow property.
///
/// 3
public string InputShadow
{
get
{
return (string)GetValue(InputShadowProperty);
}
set
{
SetValue(InputShadowProperty, value);
NotifyPropertyChanged();
}
}
///
/// The Emboss property.
///
/// 3
public string Emboss
{
get
{
return (string)GetValue(EmbossProperty);
}
set
{
SetValue(EmbossProperty, value);
NotifyPropertyChanged();
}
}
///
/// The InputEmboss property.
///
/// 3
public string InputEmboss
{
get
{
return (string)GetValue(InputEmbossProperty);
}
set
{
SetValue(InputEmbossProperty, value);
NotifyPropertyChanged();
}
}
///
/// The Outline property.
///
/// 3
public PropertyMap Outline
{
get
{
return (PropertyMap)GetValue(OutlineProperty);
}
set
{
SetValue(OutlineProperty, value);
NotifyPropertyChanged();
}
}
///
/// The InputOutline property.
///
/// 3
public string InputOutline
{
get
{
return (string)GetValue(InputOutlineProperty);
}
set
{
SetValue(InputOutlineProperty, value);
NotifyPropertyChanged();
}
}
///
/// The HiddenInputSettings property.
///
/// 3
public Tizen.NUI.PropertyMap HiddenInputSettings
{
get
{
return (PropertyMap)GetValue(HiddenInputSettingsProperty);
}
set
{
SetValue(HiddenInputSettingsProperty, value);
NotifyPropertyChanged();
}
}
///
/// The PixelSize property.
///
/// 3
public float PixelSize
{
get
{
return (float)GetValue(PixelSizeProperty);
}
set
{
SetValue(PixelSizeProperty, value);
NotifyPropertyChanged();
}
}
///
/// The Enable selection property.
///
/// 3
public bool EnableSelection
{
get
{
return (bool)GetValue(EnableSelectionProperty);
}
set
{
SetValue(EnableSelectionProperty, value);
NotifyPropertyChanged();
}
}
///
/// The Enable selection property.
///
/// 6
/// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public bool EnableGrabHandle
{
get
{
return (bool)GetValue(EnableGrabHandleProperty);
}
set
{
SetValue(EnableGrabHandleProperty, value);
NotifyPropertyChanged();
}
}
///
/// The Enable selection property.
///
/// 6
/// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public bool EnableGrabHandlePopup
{
get
{
return (bool)GetValue(EnableGrabHandlePopupProperty);
}
set
{
SetValue(EnableGrabHandlePopupProperty, value);
NotifyPropertyChanged();
}
}
///
/// 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("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("fontStyle", new PropertyValue(fontStyleMap));
///
/// TextField field = new TextField();
/// field.Placeholder = propertyMap;
///
///
/// 3
public Tizen.NUI.PropertyMap Placeholder
{
get
{
return (PropertyMap)GetValue(PlaceholderProperty);
}
set
{
SetValue(PlaceholderProperty, value);
NotifyPropertyChanged();
}
}
///
/// The Ellipsis property.
/// Enable or disable the ellipsis.
/// Placeholder PropertyMap is used to add ellipsis to placeholder text.
///
/// 4
public bool Ellipsis
{
get
{
return (bool)GetValue(EllipsisProperty);
}
set
{
SetValue(EllipsisProperty, value);
NotifyPropertyChanged();
}
}
///
/// Enables selection of the text using the Shift key.
///
/// 5
/// This will be released at Tizen.NET API Level 5, so currently this would be used as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public bool EnableShiftSelection
{
get
{
return (bool)GetValue(EnableShiftSelectionProperty);
}
set
{
SetValue(EnableShiftSelectionProperty, value);
NotifyPropertyChanged();
}
}
///
/// The text alignment to match the direction of the system language.
///
/// 6
public bool MatchSystemLanguageDirection
{
get
{
return (bool)GetValue(MatchSystemLanguageDirectionProperty);
}
set
{
SetValue(MatchSystemLanguageDirectionProperty, value);
NotifyPropertyChanged();
}
}
/// Only used by the IL of xaml, will never changed to not hidden.
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool IsCreateByXaml
{
get
{
return base.IsCreateByXaml;
}
set
{
base.IsCreateByXaml = value;
if (value == true)
{
this.TextChanged += (obj, e) =>
{
this.Text = this.Text;
};
}
}
}
///
/// Get the InputMethodContext instance.
///
/// The InputMethodContext instance.
/// 5
public InputMethodContext GetInputMethodContext()
{
if (inputMethodCotext == null)
{
/*Avoid raising InputMethodContext reference count.*/
inputMethodCotext = new InputMethodContext(Interop.TextField.TextField_GetInputMethodContext(swigCPtr), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
return inputMethodCotext;
}
///
/// Select the whole text.
///
/// 6
/// This will be released at Tizen.NET API Level 5.5, so currently this would be used as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void SelectWholeText()
{
Interop.TextField.TextField_SelectWholeText(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextField obj)
{
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal()
{
SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t(Interop.TextField.TextField_InputStyleChangedSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Dispose.
///
/// 3
protected override void Dispose(DisposeTypes type)
{
if (disposed)
{
DisposeQueue.Instance.Add(this);
return;
}
//Release your own unmanaged resources here.
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
if (this.HasBody())
{
if (_textFieldMaxLengthReachedCallbackDelegate != null)
{
this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate);
}
if (_textFieldTextChangedCallbackDelegate != null)
{
TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate);
}
}
if (swigCPtr.Handle != global::System.IntPtr.Zero)
{
if (swigCMemOwn)
{
swigCMemOwn = false;
// In order to speed up IME hide, temporarily add
GetInputMethodContext()?.DestroyContext();
Interop.TextField.delete_TextField(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
base.Dispose(type);
}
private string SetTranslatable(string textFieldSid)
{
string translatableText = null;
translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, 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 (textFieldTextSid != null)
{
Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-")));
}
if (textFieldPlaceHolderTextSid != null)
{
PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-")));
}
}
internal new class Property
{
internal static readonly int RENDERING_BACKEND = Interop.TextField.TextField_Property_RENDERING_BACKEND_get();
internal static readonly int TEXT = Interop.TextField.TextField_Property_TEXT_get();
internal static readonly int PLACEHOLDER_TEXT = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_get();
internal static readonly int PLACEHOLDER_TEXT_FOCUSED = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_FOCUSED_get();
internal static readonly int FONT_FAMILY = Interop.TextField.TextField_Property_FONT_FAMILY_get();
internal static readonly int FONT_STYLE = Interop.TextField.TextField_Property_FONT_STYLE_get();
internal static readonly int POINT_SIZE = Interop.TextField.TextField_Property_POINT_SIZE_get();
internal static readonly int MAX_LENGTH = Interop.TextField.TextField_Property_MAX_LENGTH_get();
internal static readonly int EXCEED_POLICY = Interop.TextField.TextField_Property_EXCEED_POLICY_get();
internal static readonly int HORIZONTAL_ALIGNMENT = Interop.TextField.TextField_Property_HORIZONTAL_ALIGNMENT_get();
internal static readonly int VERTICAL_ALIGNMENT = Interop.TextField.TextField_Property_VERTICAL_ALIGNMENT_get();
internal static readonly int TEXT_COLOR = Interop.TextField.TextField_Property_TEXT_COLOR_get();
internal static readonly int PLACEHOLDER_TEXT_COLOR = Interop.TextField.TextField_Property_PLACEHOLDER_TEXT_COLOR_get();
internal static readonly int PRIMARY_CURSOR_COLOR = Interop.TextField.TextField_Property_PRIMARY_CURSOR_COLOR_get();
internal static readonly int SECONDARY_CURSOR_COLOR = Interop.TextField.TextField_Property_SECONDARY_CURSOR_COLOR_get();
internal static readonly int ENABLE_CURSOR_BLINK = Interop.TextField.TextField_Property_ENABLE_CURSOR_BLINK_get();
internal static readonly int CURSOR_BLINK_INTERVAL = Interop.TextField.TextField_Property_CURSOR_BLINK_INTERVAL_get();
internal static readonly int CURSOR_BLINK_DURATION = Interop.TextField.TextField_Property_CURSOR_BLINK_DURATION_get();
internal static readonly int CURSOR_WIDTH = Interop.TextField.TextField_Property_CURSOR_WIDTH_get();
internal static readonly int GRAB_HANDLE_IMAGE = Interop.TextField.TextField_Property_GRAB_HANDLE_IMAGE_get();
internal static readonly int GRAB_HANDLE_PRESSED_IMAGE = Interop.TextField.TextField_Property_GRAB_HANDLE_PRESSED_IMAGE_get();
internal static readonly int SCROLL_THRESHOLD = Interop.TextField.TextField_Property_SCROLL_THRESHOLD_get();
internal static readonly int SCROLL_SPEED = Interop.TextField.TextField_Property_SCROLL_SPEED_get();
internal static readonly int SELECTION_HANDLE_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_IMAGE_LEFT_get();
internal static readonly int SELECTION_HANDLE_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_IMAGE_RIGHT_get();
internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get();
internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get();
internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_LEFT = Interop.TextField.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get();
internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_RIGHT = Interop.TextField.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get();
internal static readonly int SELECTION_HIGHLIGHT_COLOR = Interop.TextField.TextField_Property_SELECTION_HIGHLIGHT_COLOR_get();
internal static readonly int DECORATION_BOUNDING_BOX = Interop.TextField.TextField_Property_DECORATION_BOUNDING_BOX_get();
internal static readonly int INPUT_METHOD_SETTINGS = Interop.TextField.TextField_Property_INPUT_METHOD_SETTINGS_get();
internal static readonly int INPUT_COLOR = Interop.TextField.TextField_Property_INPUT_COLOR_get();
internal static readonly int ENABLE_MARKUP = Interop.TextField.TextField_Property_ENABLE_MARKUP_get();
internal static readonly int INPUT_FONT_FAMILY = Interop.TextField.TextField_Property_INPUT_FONT_FAMILY_get();
internal static readonly int INPUT_FONT_STYLE = Interop.TextField.TextField_Property_INPUT_FONT_STYLE_get();
internal static readonly int INPUT_POINT_SIZE = Interop.TextField.TextField_Property_INPUT_POINT_SIZE_get();
internal static readonly int UNDERLINE = Interop.TextField.TextField_Property_UNDERLINE_get();
internal static readonly int INPUT_UNDERLINE = Interop.TextField.TextField_Property_INPUT_UNDERLINE_get();
internal static readonly int SHADOW = Interop.TextField.TextField_Property_SHADOW_get();
internal static readonly int INPUT_SHADOW = Interop.TextField.TextField_Property_INPUT_SHADOW_get();
internal static readonly int EMBOSS = Interop.TextField.TextField_Property_EMBOSS_get();
internal static readonly int INPUT_EMBOSS = Interop.TextField.TextField_Property_INPUT_EMBOSS_get();
internal static readonly int OUTLINE = Interop.TextField.TextField_Property_OUTLINE_get();
internal static readonly int INPUT_OUTLINE = Interop.TextField.TextField_Property_INPUT_OUTLINE_get();
internal static readonly int HIDDEN_INPUT_SETTINGS = Interop.TextField.TextField_Property_HIDDEN_INPUT_SETTINGS_get();
internal static readonly int PIXEL_SIZE = Interop.TextField.TextField_Property_PIXEL_SIZE_get();
internal static readonly int ENABLE_SELECTION = Interop.TextField.TextField_Property_ENABLE_SELECTION_get();
internal static readonly int PLACEHOLDER = Interop.TextField.TextField_Property_PLACEHOLDER_get();
internal static readonly int ELLIPSIS = Interop.TextField.TextField_Property_ELLIPSIS_get();
internal static readonly int ENABLE_SHIFT_SELECTION = Interop.TextField.TextField_Property_ENABLE_SHIFT_SELECTION_get();
internal static readonly int MATCH_SYSTEM_LANGUAGE_DIRECTION = Interop.TextField.TextField_Property_MATCH_SYSTEM_LANGUAGE_DIRECTION_get();
internal static readonly int ENABLE_GRAB_HANDLE = Interop.TextField.TextField_Property_ENABLE_GRAB_HANDLE_get();
internal static readonly int ENABLE_GRAB_HANDLE_POPUP = Interop.TextField.TextField_Property_ENABLE_GRAB_HANDLE_POPUP_get();
}
internal class InputStyle
{
internal enum Mask
{
None = 0x0000,
Color = 0x0001,
FontFamily = 0x0002,
PointSize = 0x0004,
FontStyle = 0x0008,
Underline = 0x0010,
Shadow = 0x0020,
Emboss = 0x0040,
Outline = 0x0080
}
}
internal static readonly BindableProperty TranslatableTextSelectorProperty = BindableProperty.Create("TranslatableTextSelector", typeof(Selector), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textField = (TextField)bindable;
textField.translatableTextSelector.Clone((Selector)newValue);
},
defaultValueCreator: (bindable) =>
{
var textField = (TextField)bindable;
return textField.translatableTextSelector;
});
internal static readonly BindableProperty TranslatablePlaceholderTextSelectorProperty = BindableProperty.Create("TranslatablePlaceholderTextSelector", typeof(Selector), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textField = (TextField)bindable;
textField.translatablePlaceholderTextSelector.Clone((Selector)newValue);
},
defaultValueCreator: (bindable) =>
{
var textField = (TextField)bindable;
return textField.translatablePlaceholderTextSelector;
});
internal static readonly BindableProperty TextSelectorProperty = BindableProperty.Create("TextSelector", typeof(Selector), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textField = (TextField)bindable;
textField.textSelector.Clone((Selector)newValue);
},
defaultValueCreator: (bindable) =>
{
var textField = (TextField)bindable;
return textField.textSelector;
});
internal static readonly BindableProperty FontFamilySelectorProperty = BindableProperty.Create("FontFamilySelector", typeof(Selector), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textField = (TextField)bindable;
textField.fontFamilySelector.Clone((Selector)newValue);
},
defaultValueCreator: (bindable) =>
{
var textField = (TextField)bindable;
return textField.fontFamilySelector;
});
internal static readonly BindableProperty PointSizeSelectorProperty = BindableProperty.Create("PointSizeSelector", typeof(Selector), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textField = (TextField)bindable;
textField.pointSizeSelector.Clone((Selector)newValue);
},
defaultValueCreator: (bindable) =>
{
var textField = (TextField)bindable;
return textField.pointSizeSelector;
});
internal static readonly BindableProperty TextColorSelectorProperty = BindableProperty.Create("TextColorSelector", typeof(Selector), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textField = (TextField)bindable;
textField.textColorSelector.Clone((Selector)newValue);
},
defaultValueCreator: (bindable) =>
{
var textField = (TextField)bindable;
return textField.textColorSelector;
});
internal static readonly BindableProperty PlaceholderTextColorSelectorProperty = BindableProperty.Create("PlaceholderTextColorSelector", typeof(Selector), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textField = (TextField)bindable;
textField.placeholderTextColorSelector.Clone((Selector)newValue);
},
defaultValueCreator: (bindable) =>
{
var textField = (TextField)bindable;
return textField.placeholderTextColorSelector;
});
internal static readonly BindableProperty PrimaryCursorColorSelectorProperty = BindableProperty.Create("PrimaryCursorColorSelector", typeof(Selector), typeof(TextField), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var textField = (TextField)bindable;
textField.primaryCursorColorSelector.Clone((Selector)newValue);
},
defaultValueCreator: (bindable) =>
{
var textField = (TextField)bindable;
return textField.primaryCursorColorSelector;
});
private TriggerableSelector _translatableTextSelector;
private TriggerableSelector translatableTextSelector
{
get
{
if (null == _translatableTextSelector)
{
_translatableTextSelector = new TriggerableSelector(this, TranslatableTextProperty);
}
return _translatableTextSelector;
}
}
private TriggerableSelector _translatablePlaceholderTextSelector;
private TriggerableSelector translatablePlaceholderTextSelector
{
get
{
if (null == _translatablePlaceholderTextSelector)
{
_translatablePlaceholderTextSelector = new TriggerableSelector(this, TranslatablePlaceholderTextProperty);
}
return _translatablePlaceholderTextSelector;
}
}
private TriggerableSelector _textSelector;
private TriggerableSelector textSelector
{
get
{
if (null == _textSelector)
{
_textSelector = new TriggerableSelector(this, TextProperty);
}
return _textSelector;
}
}
private TriggerableSelector _fontFamilySelector;
private TriggerableSelector fontFamilySelector
{
get
{
if (null == _fontFamilySelector)
{
_fontFamilySelector = new TriggerableSelector(this, FontFamilyProperty);
}
return _fontFamilySelector;
}
}
private TriggerableSelector _textColorSelector;
private TriggerableSelector textColorSelector
{
get
{
if (null == _textColorSelector)
{
_textColorSelector = new TriggerableSelector(this, TextColorProperty);
}
return _textColorSelector;
}
}
private TriggerableSelector _pointSizeSelector;
private TriggerableSelector pointSizeSelector
{
get
{
if (null == _pointSizeSelector)
{
_pointSizeSelector = new TriggerableSelector(this, PointSizeProperty);
}
return _pointSizeSelector;
}
}
private TriggerableSelector _placeholderTextColorSelector;
private TriggerableSelector placeholderTextColorSelector
{
get
{
if (null == _placeholderTextColorSelector)
{
_placeholderTextColorSelector = new TriggerableSelector(this, PlaceholderTextColorProperty);
}
return _placeholderTextColorSelector;
}
}
private TriggerableSelector _primaryCursorColorSelector;
private TriggerableSelector primaryCursorColorSelector
{
get
{
if (null == _primaryCursorColorSelector)
{
_primaryCursorColorSelector = new TriggerableSelector(this, PrimaryCursorColorProperty);
}
return _primaryCursorColorSelector;
}
}
private void OnDecorationBoundingBoxChanged(int x, int y, int width, int height)
{
DecorationBoundingBox = new Rectangle(x, y, width, height);
}
private void OnInputColorChanged(float x, float y, float z, float w)
{
InputColor = new Vector4(x, y, z, w);
}
private void OnPlaceholderTextColorChanged(float r, float g, float b, float a)
{
PlaceholderTextColor = new Vector4(r, g, b, a);
}
private void OnPrimaryCursorColorChanged(float x, float y, float z, float w)
{
PrimaryCursorColor = new Vector4(x, y, z, w);
}
private void OnSecondaryCursorColorChanged(float x, float y, float z, float w)
{
SecondaryCursorColor = new Vector4(x, y, z, w);
}
private void OnSelectionHighlightColorChanged(float x, float y, float z, float w)
{
SelectionHighlightColor = new Vector4(x, y, z, w);
}
private void OnShadowColorChanged(float x, float y, float z, float w)
{
ShadowColor = new Vector4(x, y, z, w);
}
private void OnShadowOffsetChanged(float x, float y)
{
ShadowOffset = new Vector2(x, y);
}
private void OnTextColorChanged(float r, float g, float b, float a)
{
TextColor = new Color(r, g, b, a);
}
}
}