e79aa3c0ed
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
94 lines
3.1 KiB
C#
94 lines
3.1 KiB
C#
//------------------------------------------------------------------------------
|
|
// <copyright file="BrowsableAttribute.cs" company="Microsoft">
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// </copyright>
|
|
//------------------------------------------------------------------------------
|
|
|
|
/*
|
|
*/
|
|
namespace System.ComponentModel {
|
|
using System;
|
|
using System.ComponentModel;
|
|
using System.Diagnostics;
|
|
using System.Security.Permissions;
|
|
|
|
/// <devdoc>
|
|
/// <para>Specifies whether a property or event should be displayed in
|
|
/// a property browsing window.</para>
|
|
/// </devdoc>
|
|
[AttributeUsage(AttributeTargets.All)]
|
|
public sealed class BrowsableAttribute : Attribute {
|
|
/// <devdoc>
|
|
/// <para>
|
|
/// Specifies that a property or event can be modified at
|
|
/// design time. This <see langword='static '/>
|
|
/// field is read-only.
|
|
/// </para>
|
|
/// </devdoc>
|
|
public static readonly BrowsableAttribute Yes = new BrowsableAttribute(true);
|
|
|
|
/// <devdoc>
|
|
/// <para>
|
|
/// Specifies that a property or event cannot be modified at
|
|
/// design time. This <see langword='static '/>field is read-only.
|
|
/// </para>
|
|
/// </devdoc>
|
|
public static readonly BrowsableAttribute No = new BrowsableAttribute(false);
|
|
|
|
/// <devdoc>
|
|
/// <para>Specifies the default value for the <see cref='System.ComponentModel.BrowsableAttribute'/>,
|
|
/// which is <see cref='System.ComponentModel.BrowsableAttribute.Yes'/>. This <see langword='static '/>field is read-only.</para>
|
|
/// </devdoc>
|
|
public static readonly BrowsableAttribute Default = Yes;
|
|
|
|
private bool browsable = true;
|
|
|
|
/// <devdoc>
|
|
/// <para>Initializes a new instance of the <see cref='System.ComponentModel.BrowsableAttribute'/> class.</para>
|
|
/// </devdoc>
|
|
public BrowsableAttribute(bool browsable) {
|
|
this.browsable = browsable;
|
|
}
|
|
|
|
/// <devdoc>
|
|
/// <para>
|
|
/// Gets a value indicating whether an object is browsable.
|
|
/// </para>
|
|
/// </devdoc>
|
|
public bool Browsable {
|
|
get {
|
|
return browsable;
|
|
}
|
|
}
|
|
|
|
/// <internalonly/>
|
|
/// <devdoc>
|
|
/// </devdoc>
|
|
public override bool Equals(object obj) {
|
|
if (obj == this) {
|
|
return true;
|
|
}
|
|
|
|
BrowsableAttribute other = obj as BrowsableAttribute;
|
|
|
|
return (other != null) && other.Browsable == browsable;
|
|
}
|
|
|
|
/// <devdoc>
|
|
/// <para>[To be supplied.]</para>
|
|
/// </devdoc>
|
|
public override int GetHashCode() {
|
|
return browsable.GetHashCode();
|
|
}
|
|
|
|
#if !SILVERLIGHT
|
|
/// <internalonly/>
|
|
/// <devdoc>
|
|
/// </devdoc>
|
|
public override bool IsDefaultAttribute() {
|
|
return (this.Equals(Default));
|
|
}
|
|
#endif
|
|
}
|
|
}
|