94e9a440c3cebd9e2060ed15f3dc45867c911ef1
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Design / Tizen.NUI / AttributeTableBuilder.cs
1 using System;
2 using System.ComponentModel;
3 using System.Reflection;
4 using Tizen.NUI.BaseComponents;
5 using Tizen.NUI.UIComponents;
6
7 namespace Tizen.NUI
8 {
9     internal class AttributeTableBuilder : Microsoft.Windows.Design.Metadata.AttributeTableBuilder
10     {
11         private void AddAttributesForTypes()
12         {
13             Type typeFromHandle = typeof(ContentPage);
14             typeFromHandle = typeof(PushButton);
15             AddTypeAttributes(typeFromHandle, new EditorBrowsableAttribute(EditorBrowsableState.Always));
16             typeFromHandle = typeof(ContentPage);
17             AddTypeAttributes(typeFromHandle, new EditorBrowsableAttribute(EditorBrowsableState.Always));
18             AddTypeAttributes(typeFromHandle, new global::System.Windows.Markup.ContentPropertyAttribute("Content"));
19             typeFromHandle = typeof(TextEditor);
20             AddTypeAttributes(typeFromHandle, new EditorBrowsableAttribute(EditorBrowsableState.Always));
21             typeFromHandle = typeof(FlexContainer);
22             AddTypeAttributes(typeFromHandle, new EditorBrowsableAttribute(EditorBrowsableState.Always));
23             typeFromHandle = typeof(ImageView);
24             AddTypeAttributes(typeFromHandle, new EditorBrowsableAttribute(EditorBrowsableState.Always));
25             typeFromHandle = typeof(TextLabel);
26             AddTypeAttributes(typeFromHandle, new EditorBrowsableAttribute(EditorBrowsableState.Always));
27             typeFromHandle = typeof(TextField);
28             AddTypeAttributes(typeFromHandle, new EditorBrowsableAttribute(EditorBrowsableState.Always));
29             typeFromHandle = typeof(ProgressBar);
30             AddTypeAttributes(typeFromHandle, new EditorBrowsableAttribute(EditorBrowsableState.Always));
31             typeFromHandle = typeof(ScrollView);
32             AddTypeAttributes(typeFromHandle, new EditorBrowsableAttribute(EditorBrowsableState.Always));
33             typeFromHandle = typeof(ScrollBar);
34             AddTypeAttributes(typeFromHandle, new EditorBrowsableAttribute(EditorBrowsableState.Always));
35             typeFromHandle = typeof(Slider);
36             AddTypeAttributes(typeFromHandle, new EditorBrowsableAttribute(EditorBrowsableState.Always));
37             typeFromHandle = typeof(TableView);
38             AddTypeAttributes(typeFromHandle, new EditorBrowsableAttribute(EditorBrowsableState.Always));
39             typeFromHandle = typeof(View);
40             AddTypeAttributes(typeFromHandle, new EditorBrowsableAttribute(EditorBrowsableState.Always));
41             AddTypeAttributes(typeFromHandle, new global::System.Windows.Markup.ContentPropertyAttribute("Children"));
42         }
43
44         [EditorBrowsable(EditorBrowsableState.Never)]
45         public AttributeTableBuilder() : base()
46         {
47             Assembly assembly = typeof(View).Assembly;
48             AddAssemblyAttributes(assembly, new global::System.Windows.Markup.XmlnsDefinitionAttribute("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI"));
49             AddAssemblyAttributes(assembly, new global::System.Windows.Markup.XmlnsDefinitionAttribute("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI.BaseComponents"));
50             AddAssemblyAttributes(assembly, new global::System.Windows.Markup.XmlnsDefinitionAttribute("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI.UIComponents"));
51             AddAssemblyAttributes(assembly, new global::System.Windows.Markup.XmlnsDefinitionAttribute("http://tizen.org/Tizen.NUI/2018/XAML", "Tizen.NUI.Xaml"));
52             AddAttributesForTypes();
53         }
54
55         private void AddTypeAttributes(Type type, params Attribute[] attribs)
56         {
57             this.AddCallback(type, builder => builder.AddCustomAttributes(attribs));
58         }
59
60         private void AddMemberAttributes(Type type, string memberName, params Attribute[] attribs)
61         {
62             this.AddCallback(type, builder => builder.AddCustomAttributes(attribs));
63         }
64
65         private void AddAssemblyAttributes(Assembly assembly, params Attribute[] attribs)
66         {
67             this.AddCustomAttributes(assembly, attribs);
68         }
69     }
70 }