[NUI] Add SetUnderline, GetUnderline to Text Components
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / RiveAnimationView.cs
1 /*
2 * Copyright(c) 2021 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 using System;
18 using System.ComponentModel;
19 using System.Collections.Generic;
20 using System.Diagnostics.CodeAnalysis;
21
22 namespace Tizen.NUI.BaseComponents
23 {
24     /// <summary>
25     /// RiveAnimationView renders an animated vector image (Rive file).
26     /// </summary>
27     [EditorBrowsable(EditorBrowsableState.Never)]
28     public class RiveAnimationView : View
29     {
30         static RiveAnimationView() { }
31
32         /// <summary>
33         /// RiveAnimationView constructor.
34         /// </summary>
35         /// <param name="url">The rive resource URL</param>
36         ///[EditorBrowsable(EditorBrowsableState.Never)]
37         public RiveAnimationView(string url) : this(Interop.RiveAnimationView.New(url), true)
38         {
39             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
40         }
41
42         internal RiveAnimationView(global::System.IntPtr cPtr, bool shown = true) : base(cPtr, shown)
43         {
44             if (!shown)
45             {
46                 SetVisible(false);
47             }
48         }
49
50         /// <summary>
51         /// Eanables the given animation.
52         /// </summary>
53         /// <param name="animationName">The animation to enable</param>
54         /// <param name="on">The enable state of given animation</param>
55         [EditorBrowsable(EditorBrowsableState.Never)]
56         public void EnableAnimation(string animationName, bool on)
57         {
58             Interop.RiveAnimationView.EnableAnimation(SwigCPtr, animationName, on);
59         }
60
61         /// <summary>
62         /// Play animation.
63         /// </summary>
64         [EditorBrowsable(EditorBrowsableState.Never)]
65         public void Play()
66         {
67             Interop.RiveAnimationView.Play(SwigCPtr);
68         }
69
70         /// <summary>
71         /// Pause animation.
72         /// </summary>
73         [EditorBrowsable(EditorBrowsableState.Never)]
74         public void Pause()
75         {
76             Interop.RiveAnimationView.Pause(SwigCPtr);
77         }
78
79         /// <summary>
80         /// Stop animation.
81         /// </summary>
82         [EditorBrowsable(EditorBrowsableState.Never)]
83         public void Stop()
84         {
85             Interop.RiveAnimationView.Stop(SwigCPtr);
86         }
87
88         /// <summary>
89         /// Sets the fill color of given fill.
90         /// </summary>
91         /// <param name="shapeFillName">The shape fill name</param>
92         /// <param name="color">The rgba color</param>
93         [EditorBrowsable(EditorBrowsableState.Never)]
94         public void SetShapeFillColor(string shapeFillName, Color color)
95         {
96             if (color == null)
97                  throw new ArgumentNullException(nameof(color));
98             Interop.RiveAnimationView.SetShapeFillColor(SwigCPtr, shapeFillName, color.SwigCPtr);
99         }
100
101         /// <summary>
102         /// Sets the shape stroke color of given stroke.
103         /// </summary>
104         /// <param name="shapeStrokeName">The shape stroke name</param>
105         /// <param name="color">The rgba color</param>
106         [EditorBrowsable(EditorBrowsableState.Never)]
107         public void SetShapeStrokeColor(string shapeStrokeName, Color color)
108         {
109             if (color == null)
110                  throw new ArgumentNullException(nameof(color));
111             Interop.RiveAnimationView.SetShapeStrokeColor(SwigCPtr, shapeStrokeName, color.SwigCPtr);
112         }
113
114         /// <summary>
115         /// Sets the opacity of given node.
116         /// </summary>
117         /// <param name="nodeName">The node name</param>
118         /// <param name="opacity">The opacity of given node</param>
119         [EditorBrowsable(EditorBrowsableState.Never)]
120         public void SetNodeOpacity(string nodeName, float opacity)
121         {
122             Interop.RiveAnimationView.SetNodeOpacity(SwigCPtr, nodeName, opacity);
123         }
124
125         /// <summary>
126         /// Sets the scale of given node.
127         /// </summary>
128         /// <param name="nodeName">The node name</param>
129         /// <param name="scale">The scale of given node</param>
130         [EditorBrowsable(EditorBrowsableState.Never)]
131         public void SetNodeScale(string nodeName, Vector2 scale)
132         {
133             if (scale == null)
134                  throw new ArgumentNullException(nameof(scale));
135             Interop.RiveAnimationView.SetNodeScale(SwigCPtr, nodeName, Vector2.getCPtr(scale));
136         }
137
138         /// <summary>
139         /// Sets the rotation of given node.
140         /// </summary>
141         /// <param name="nodeName">The node name</param>
142         /// <param name="degree">The degree of given node</param>
143         [EditorBrowsable(EditorBrowsableState.Never)]
144         public void SetNodeRotation(string nodeName, Degree degree)
145         {            
146             if (degree == null)
147                  throw new ArgumentNullException(nameof(degree));
148             Interop.RiveAnimationView.SetNodeRotation(SwigCPtr, nodeName, Degree.getCPtr(degree));
149         }
150
151         /// <summary>
152         /// Sets the position of given node.
153         /// </summary>
154         /// <param name="nodeName">The node name</param>
155         /// <param name="position">The position of given node</param>
156         [EditorBrowsable(EditorBrowsableState.Never)]
157         public void SetNodePosition(string nodeName, Position position)
158         {
159             if (position == null)
160                  throw new ArgumentNullException(nameof(position));
161             Interop.RiveAnimationView.SetNodePosition(SwigCPtr, nodeName, position.SwigCPtr);
162         }
163
164         /// <summary>
165         /// Sets the animation elapsed time.
166         /// </summary>
167         /// <param name="animationName">The animation name</param>
168         /// <param name="elapsed">The elapsed time</param>
169         [EditorBrowsable(EditorBrowsableState.Never)]
170         public void SetAnimationElapsedTime(string animationName, float elapsed)
171         {
172             Interop.RiveAnimationView.SetAnimationElapsedTime(SwigCPtr, animationName, elapsed);
173         }
174     }
175 }