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.
19 using System.ComponentModel;
20 using Tizen.NUI.Binding;
27 public class KeyValue : Disposable
32 public int? KeyInt = null;
37 public string KeyString = null;
42 public PropertyValue TrueValue = null;
44 private string _key = null;
45 private object _originalValue = null;
46 private object _originalKey = null;
49 /// Default Constructor.
55 /// destructor. This is HiddenAPI. recommended not to use in public.
57 [EditorBrowsable(EditorBrowsableState.Never)]
80 /// OriginalKey property.
82 public object OriginalKey
91 if (value is int || value is Int32)
95 else if (value is string)
97 KeyString = value.ToString();
99 else if (value.GetType().Equals(typeof(int)) || value.GetType().Equals(typeof(Int32)))
103 else if (value.GetType().Equals(typeof(string)))
105 KeyString = value.ToString();
117 return _originalValue;
121 _originalValue = value;
122 TrueValue = PropertyValue.CreateFromObject(value);
127 /// IntergerValue property.
129 public int IntergerValue
133 TrueValue = new PropertyValue(value);
138 /// BooleanValue property.
140 public bool BooleanValue
144 TrueValue = new PropertyValue(value);
149 /// SingleValue property.
151 public float SingleValue
155 TrueValue = new PropertyValue(value);
160 /// StringValue property.
162 public string StringValue
166 TrueValue = new PropertyValue(value);
171 /// Vector2Value property.
173 public Vector2 Vector2Value
177 TrueValue = new PropertyValue(value);
182 /// Vector3Value property.
184 public Vector3 Vector3Value
188 TrueValue = new PropertyValue(value);
193 /// Vector4Value property.
195 public Vector4 Vector4Value
199 TrueValue = new PropertyValue(value);
204 /// PositionValue property.
206 public Position PositionValue
210 TrueValue = new PropertyValue(value);
215 /// Position2DValue property.
217 public Position2D Position2DValue
221 TrueValue = new PropertyValue(value);
226 /// SizeValue property.
228 public Size SizeValue
232 TrueValue = new PropertyValue(value);
237 /// Size2DValue property.
239 public Size2D Size2DValue
243 TrueValue = new PropertyValue(value);
248 /// ColorValue property.
250 public Color ColorValue
254 TrueValue = new PropertyValue(value);
259 /// RectangleValue property.
261 public Rectangle RectangleValue
265 TrueValue = new PropertyValue(value);
270 /// RotationValue property.
272 public Rotation RotationValue
276 TrueValue = new PropertyValue(value);
281 /// RelativeVector2Value property.
283 public RelativeVector2 RelativeVector2Value
287 TrueValue = new PropertyValue(value);
292 /// RelativeVector3Value property.
294 public RelativeVector3 RelativeVector3Value
298 TrueValue = new PropertyValue(value);
303 /// RelativeVector4Value property.
305 public RelativeVector4 RelativeVector4Value
309 TrueValue = new PropertyValue(value);
314 /// ExtentsValue property.
316 public Extents ExtentsValue
320 TrueValue = new PropertyValue(value);
325 /// PropertyArrayValue property.
327 public PropertyArray PropertyArrayValue
331 TrueValue = new PropertyValue(value);
336 /// PropertyMapValue property.
338 public PropertyMap PropertyMapValue
342 TrueValue = new PropertyValue(value);
346 private void ParseKey(string key)
349 if (VisualExtension.KeyDictionary.ContainsKey(key))
351 VisualExtension.KeyDictionary.TryGetValue(key, out v);
361 /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
363 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
364 [EditorBrowsable(EditorBrowsableState.Never)]
365 protected override void Dispose(DisposeTypes type)
372 TrueValue?.Dispose();