ListBindableAttribute.cs 1.4 KB

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