[NUI.Scene3D] Make API to apply ModelMotion
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Scene3D / src / public / ModelMotion / MotionValue.cs
1 /*
2  * Copyright(c) 2023 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 using System;
19 using System.ComponentModel;
20 using System.Collections.Generic;
21 using Tizen.NUI;
22
23 namespace Tizen.NUI.Scene3D
24 {
25     /// <summary>
26     /// Target value of motion. It can be define as specific PropertyValue, or KeyFrames
27     /// </summary>
28     [EditorBrowsable(EditorBrowsableState.Never)]
29     public class MotionValue : IDisposable
30     {
31         private IDisposable internalValue = null;
32
33         /// <summary>
34         /// Determine whether current stored value is PropertyValue, or KeyFrames.
35         /// </summary>
36         [EditorBrowsable(EditorBrowsableState.Never)]
37         public enum ValueType
38         {
39             /// <summary>
40             /// Value is null, or invalid class.
41             /// </summary>
42             [EditorBrowsable(EditorBrowsableState.Never)]
43             Invalid,
44
45             /// <summary>
46             /// Value is PropertyValue.
47             /// </summary>
48             [EditorBrowsable(EditorBrowsableState.Never)]
49             Property,
50
51             /// <summary>
52             /// Value is KeyFrames.
53             /// </summary>
54             [EditorBrowsable(EditorBrowsableState.Never)]
55             KeyFrames,
56         }
57
58         /// <summary>
59         /// Create an initialized motion value with invalid.
60         /// </summary>
61         [EditorBrowsable(EditorBrowsableState.Never)]
62         public MotionValue()
63         {
64         }
65
66         /// <summary>
67         /// Get or set the value as PropertyValue type.
68         /// It will return null if value is not PropertyValue.
69         /// </summary>
70         [EditorBrowsable(EditorBrowsableState.Never)]
71         public PropertyValue Value
72         {
73             get
74             {
75                 return internalValue as PropertyValue;
76             }
77             set
78             {
79                 internalValue = (Disposable)value;
80             }
81         }
82
83         /// <summary>
84         /// Get or set the value as KeyFrames type.
85         /// It will return null if value is not KeyFrames.
86         /// </summary>
87         [EditorBrowsable(EditorBrowsableState.Never)]
88         public KeyFrames KeyFramesValue
89         {
90             get
91             {
92                 return internalValue as KeyFrames;
93             }
94             set
95             {
96                 internalValue = (BaseHandle)value;
97             }
98         }
99
100         /// <summary>
101         /// Get the type of value what we setted.
102         /// </summary>
103         [EditorBrowsable(EditorBrowsableState.Never)]
104         public ValueType Type
105         {
106             get
107             {
108                 if (internalValue is KeyFrames)
109                 {
110                     return ValueType.KeyFrames;
111                 }
112                 if (internalValue is PropertyValue)
113                 {
114                     return ValueType.Property;
115                 }
116                 return ValueType.Invalid;
117             }
118         }
119
120         /// <summary>
121         /// IDisposable.Dipsose.
122         /// </summary>
123         [EditorBrowsable(EditorBrowsableState.Never)]
124         public void Dispose()
125         {
126             internalValue?.Dispose();
127         }
128     }
129 }