2 * Copyright(c) 2020 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 namespace Tizen.NUI.BaseComponents
21 /// The class storing extra data for a TextField to optimize size of it.
23 internal class TextFieldSelectorData
25 public TriggerableSelector<string> TranslatableText { get; } = new TriggerableSelector<string>(TextField.TranslatableTextProperty);
26 public TriggerableSelector<string> Text { get; } = new TriggerableSelector<string>(TextField.TextProperty);
27 public TriggerableSelector<string> FontFamily { get; } = new TriggerableSelector<string>(TextField.FontFamilyProperty);
28 public TriggerableSelector<Color> TextColor { get; } = new TriggerableSelector<Color>(TextField.TextColorProperty, GetTextColor);
29 public TriggerableSelector<float?> PointSize { get; } = new TriggerableSelector<float?>(TextField.PointSizeProperty);
30 public TriggerableSelector<string> TranslatablePlaceholderText { get; } = new TriggerableSelector<string>(TextField.TranslatablePlaceholderTextProperty);
31 public TriggerableSelector<Vector4> PlaceholderTextColor { get; } = new TriggerableSelector<Vector4>(TextField.PlaceholderTextColorProperty, delegate (View view)
33 Vector4 color = new Vector4();
34 if (view.GetProperty(TextField.Property.PlaceholderTextColor).Get(color))
41 public TriggerableSelector<Vector4> PrimaryCursorColor { get; } = new TriggerableSelector<Vector4>(TextField.PrimaryCursorColorProperty, delegate (View view)
43 Vector4 color = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
44 if (view.GetProperty(TextField.Property.PrimaryCursorColor).Get(color))
51 public void Reset(View view)
53 TranslatableText.Reset(view);
55 FontFamily.Reset(view);
56 TextColor.Reset(view);
57 PointSize.Reset(view);
58 TranslatablePlaceholderText.Reset(view);
59 PlaceholderTextColor.Reset(view);
60 PrimaryCursorColor.Reset(view);
63 private static Color GetTextColor(View view)
65 Color color = new Color();
66 if (view.GetProperty(TextField.Property.TextColor).Get(color))