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