DesignTimeVisibleAttribute.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // System.ComponentModel.DesignTimeVisibleAttribute.cs
  3. //
  4. // Author:
  5. // Tim Coleman ([email protected])
  6. // Andreas Nahr ([email protected])
  7. //
  8. // Copyright (C) Tim Coleman, 2002
  9. // (C) 2003 Andreas Nahr
  10. //
  11. namespace System.ComponentModel {
  12. [AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface)]
  13. public sealed class DesignTimeVisibleAttribute : Attribute
  14. {
  15. #region Fields
  16. private bool visible;
  17. public static readonly DesignTimeVisibleAttribute Default = new DesignTimeVisibleAttribute (true);
  18. public static readonly DesignTimeVisibleAttribute No = new DesignTimeVisibleAttribute (false);
  19. public static readonly DesignTimeVisibleAttribute Yes = new DesignTimeVisibleAttribute (true);
  20. #endregion // Fields
  21. #region Constructors
  22. public DesignTimeVisibleAttribute ()
  23. : this (true)
  24. {
  25. }
  26. public DesignTimeVisibleAttribute (bool visible)
  27. {
  28. this.visible = visible;
  29. }
  30. #endregion // Constructors
  31. #region Properties
  32. public bool Visible {
  33. get { return visible; }
  34. }
  35. #endregion // Properties
  36. #region Methods
  37. public override bool Equals (object obj)
  38. {
  39. if (!(obj is DesignTimeVisibleAttribute))
  40. return false;
  41. if (obj == this)
  42. return true;
  43. return ((DesignTimeVisibleAttribute) obj).Visible == visible;
  44. }
  45. public override int GetHashCode ()
  46. {
  47. return visible.GetHashCode ();
  48. }
  49. public override bool IsDefaultAttribute ()
  50. {
  51. return visible == DesignTimeVisibleAttribute.Default.Visible;
  52. }
  53. #endregion // Methods
  54. }
  55. }