2 * Copyright(c) 2021 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.Collections.Generic;
20 using System.ComponentModel;
22 namespace Tizen.NUI.BaseComponents.VectorGraphics
25 /// A class enabling to hold many Drawable objects. As a whole they can be transformed, their transparency can be changed.
27 [EditorBrowsable(EditorBrowsableState.Never)]
28 public class DrawableGroup : Drawable
30 private List<Drawable> drawables; //The list of added drawables
33 /// Creates an initialized DrawableGroup.
35 [EditorBrowsable(EditorBrowsableState.Never)]
36 public DrawableGroup() : this(Interop.DrawableGroup.New(), true)
38 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
41 internal DrawableGroup(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
43 drawables = new List<Drawable>();
47 /// Add drawable object to the DrawableGroup. This method is similar to registration.
49 /// <param name="drawable">Drawable object</param>
50 /// <exception cref="ArgumentNullException"> Thrown when drawable is null. </exception>
51 [EditorBrowsable(EditorBrowsableState.Never)]
52 public void AddDrawable(Drawable drawable)
56 throw new ArgumentNullException(nameof(drawable));
58 Interop.DrawableGroup.AddDrawable(View.getCPtr(this), BaseHandle.getCPtr(drawable));
59 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
60 if (!drawables.Contains(drawable))
62 drawables.Add(drawable);
67 /// Clears the drawable object added to the DrawableGroup.
68 /// This method does not free the memory of the added drawable object.
70 /// <returns>True when it's successful. False otherwise.</returns>
71 [EditorBrowsable(EditorBrowsableState.Never)]
74 bool ret = Interop.DrawableGroup.Clear(BaseHandle.getCPtr(this));
75 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();