2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
19 using System.Runtime.InteropServices;
\r
20 using System.Collections.Generic;
\r
26 public class VisualView : CustomView
\r
28 //private LinkedList<VisualBase> _visualList = null;
\r
29 private Dictionary<int, VisualBase> _visualDictionary = null;
\r
31 static CustomView CreateInstance()
\r
33 return new VisualView();
\r
36 // static constructor registers the control type (only runs once)
\r
39 // ViewRegistry registers control type with DALi type registery
\r
40 // also uses introspection to find any properties that need to be registered with type registry
\r
41 ViewRegistry.Instance.Register(CreateInstance, typeof(VisualView) );
\r
44 public VisualView() : base(typeof(VisualView).Name, ViewWrapperImpl.CustomViewBehaviour.REQUIRES_KEYBOARD_NAVIGATION_SUPPORT | ViewWrapperImpl.CustomViewBehaviour.DISABLE_STYLE_CHANGE_SIGNALS)
\r
48 public override void OnInitialize()
\r
51 _visualDictionary = new Dictionary<int, VisualBase>();
\r
55 public void AddVisual( VisualBase visual )
\r
57 //_visualDictionary.Add( visual );
\r
58 string visualViewProperty = "visualViewProperty" + _visualDictionary.Count;
\r
59 Console.WriteLine ("--------------visualViewProperty name: " + visualViewProperty );
\r
61 int visualViewPropertyIndex = RegisterProperty( visualViewProperty, new Tizen.NUI.Property.Value(visualViewProperty), Tizen.NUI.Property.AccessMode.READ_WRITE);
\r
62 _visualDictionary.Add( visualViewPropertyIndex, visual );
\r
64 RegisterVisual( visualViewPropertyIndex, visual );
\r
67 public void RemoveVisual( VisualBase visual )
\r
69 int foundIndex = -1;
\r
71 foreach (var item in _visualDictionary)
\r
73 if (item.Value == visual)
\r
75 foundIndex = item.Key;
\r
76 EnableVisual(foundIndex, false);
\r
77 UnregisterVisual(foundIndex);
\r
78 _visualDictionary.Remove(foundIndex);
\r
83 public int NumOfVisual()
\r
85 return _visualDictionary.Count;
\r
88 public void DisposeAllVisual()
\r