ListBindableAttribute.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // System.ComponentModel.ListBindableAttribute
  3. //
  4. // Authors:
  5. // Gonzalo Paniagua Javier ([email protected])
  6. //
  7. // (C) 2002 Ximian, Inc (http://www.ximian.com)
  8. //
  9. using System;
  10. namespace System.ComponentModel
  11. {
  12. [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)]
  13. public sealed class ListBindableAttribute : Attribute
  14. {
  15. public static readonly ListBindableAttribute Default = new ListBindableAttribute (true, true);
  16. public static readonly ListBindableAttribute No = new ListBindableAttribute (false, true);
  17. public static readonly ListBindableAttribute Yes = new ListBindableAttribute (true, true);
  18. bool deflt;
  19. bool bindable;
  20. private ListBindableAttribute (bool listBindable, bool deflt)
  21. {
  22. this.deflt = deflt;
  23. bindable = listBindable;
  24. }
  25. public ListBindableAttribute (bool listBindable)
  26. {
  27. deflt = false;
  28. bindable = true;
  29. }
  30. public ListBindableAttribute (BindableSupport flags)
  31. {
  32. bindable = (flags == BindableSupport.Yes);
  33. deflt = (flags == BindableSupport.Default);
  34. }
  35. public override bool Equals (object obj)
  36. {
  37. if (!(obj is ListBindableAttribute))
  38. return false;
  39. return (((ListBindableAttribute) obj).bindable == bindable &&
  40. ((ListBindableAttribute) obj).deflt == deflt);
  41. }
  42. public override int GetHashCode ()
  43. {
  44. return base.GetHashCode ();
  45. }
  46. public override bool IsDefaultAttribute ()
  47. {
  48. return deflt;
  49. }
  50. public bool ListBindable
  51. {
  52. get {
  53. return bindable;
  54. }
  55. }
  56. }
  57. }