[NUI] Adjust directory (#903)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / XamlBinding / Interactivity / Behavior.cs
1 using System;
2 using System.ComponentModel;
3 using System.Reflection;
4
5 namespace Tizen.NUI.Binding
6 {
7     /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
8     [EditorBrowsable(EditorBrowsableState.Never)]
9     public abstract class Behavior : BindableObject, IAttachedObject
10     {
11         internal Behavior(Type associatedType)
12         {
13             if (associatedType == null)
14                 throw new ArgumentNullException("associatedType");
15             AssociatedType = associatedType;
16         }
17
18         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
19         [EditorBrowsable(EditorBrowsableState.Never)]
20         protected Type AssociatedType { get; }
21
22         void IAttachedObject.AttachTo(BindableObject bindable)
23         {
24             if (bindable == null)
25                 throw new ArgumentNullException("bindable");
26             if (!AssociatedType.IsInstanceOfType(bindable))
27                 throw new InvalidOperationException("bindable not an instance of AssociatedType");
28             OnAttachedTo(bindable);
29         }
30
31         void IAttachedObject.DetachFrom(BindableObject bindable)
32         {
33             OnDetachingFrom(bindable);
34         }
35
36         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
37         [EditorBrowsable(EditorBrowsableState.Never)]
38         protected virtual void OnAttachedTo(BindableObject bindable)
39         {
40         }
41
42         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
43         [EditorBrowsable(EditorBrowsableState.Never)]
44         protected virtual void OnDetachingFrom(BindableObject bindable)
45         {
46         }
47     }
48
49     /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
50     [EditorBrowsable(EditorBrowsableState.Never)]
51     public abstract class Behavior<T> : Behavior where T : BindableObject
52     {
53         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
54         [EditorBrowsable(EditorBrowsableState.Never)]
55         protected Behavior() : base(typeof(T))
56         {
57         }
58
59         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
60         [EditorBrowsable(EditorBrowsableState.Never)]
61         protected override void OnAttachedTo(BindableObject bindable)
62         {
63             base.OnAttachedTo(bindable);
64             OnAttachedTo((T)bindable);
65         }
66
67         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
68         [EditorBrowsable(EditorBrowsableState.Never)]
69         protected virtual void OnAttachedTo(T bindable)
70         {
71         }
72
73         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
74         [EditorBrowsable(EditorBrowsableState.Never)]
75         protected override void OnDetachingFrom(BindableObject bindable)
76         {
77             OnDetachingFrom((T)bindable);
78             base.OnDetachingFrom(bindable);
79         }
80
81         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
82         [EditorBrowsable(EditorBrowsableState.Never)]
83         protected virtual void OnDetachingFrom(T bindable)
84         {
85         }
86     }
87 }