Initial commit
[mono.git] / mcs / class / referencesource / System / compmod / system / componentmodel / design / RefreshPropertiesAttribute.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="RefreshPropertiesAttribute.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>                                                                
5 //------------------------------------------------------------------------------
6
7 /*
8  */
9 namespace System.ComponentModel {
10     using System.Security.Permissions;
11
12     /// <devdoc>
13     ///    <para> Specifies how a designer refreshes when the property value is changed.</para>
14     /// </devdoc>
15     [AttributeUsage(AttributeTargets.All)]
16     public sealed class RefreshPropertiesAttribute : Attribute {
17
18         /// <devdoc>
19         ///    <para>
20         ///       Indicates all properties should
21         ///       be refreshed if the property value is changed. This field is
22         ///       read-only.
23         ///    </para>
24         /// </devdoc>
25         public static readonly RefreshPropertiesAttribute All = new RefreshPropertiesAttribute(RefreshProperties.All);
26
27         /// <devdoc>
28         ///    <para>
29         ///       Indicates all properties should
30         ///       be invalidated and repainted if the
31         ///       property value is changed. This field is read-only.
32         ///    </para>
33         /// </devdoc>
34         public static readonly RefreshPropertiesAttribute Repaint = new RefreshPropertiesAttribute(RefreshProperties.Repaint);
35
36         /// <devdoc>
37         ///    <para>
38         ///       Indicates that by default
39         ///       no
40         ///       properties should be refreshed if the property value
41         ///       is changed. This field is read-only.
42         ///    </para>
43         /// </devdoc>
44         public static readonly RefreshPropertiesAttribute Default = new RefreshPropertiesAttribute(RefreshProperties.None);
45
46         private RefreshProperties refresh;
47
48         /// <devdoc>
49         /// </devdoc>
50         /// <internalonly/>
51         public RefreshPropertiesAttribute(RefreshProperties refresh) {
52             this.refresh = refresh;
53         }
54
55         /// <devdoc>
56         ///    <para>
57         ///       Gets or sets
58         ///       the refresh properties for the member.
59         ///    </para>
60         /// </devdoc>
61         public RefreshProperties RefreshProperties {
62             get {
63                 return refresh;
64             }
65         }
66
67         /// <devdoc>
68         ///    <para>
69         ///       Overrides object's Equals method.
70         ///    </para>
71         /// </devdoc>
72         public override bool Equals(object value) {
73             if (value is RefreshPropertiesAttribute) {
74                 return(((RefreshPropertiesAttribute)value).RefreshProperties == refresh);
75             }
76             return false;
77         }
78
79         /// <devdoc>
80         ///    <para>
81         ///       Returns the hashcode for this object.
82         ///    </para>
83         /// </devdoc>
84         public override int GetHashCode() {
85             return base.GetHashCode();
86         }
87
88         /// <devdoc>
89         ///    <para>Gets a value indicating whether the current attribute is the default.</para>
90         /// </devdoc>
91         public override bool IsDefaultAttribute() {
92             return this.Equals(Default);
93         }
94     }
95 }
96