CategoryAttribute.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. //
  2. // System.ComponentModel.CategoryAttribute.cs
  3. //
  4. // Author:
  5. // Miguel de Icaza ([email protected])
  6. //
  7. // (C) Ximian, Inc. http://www.ximian.com
  8. //
  9. //
  10. namespace System.ComponentModel {
  11. [AttributeUsage (AttributeTargets.Property | AttributeTargets.Event)]
  12. public class CategoryAttribute : Attribute {
  13. string category;
  14. static CategoryAttribute action, appearance, behaviour, data, def;
  15. static CategoryAttribute design, drag_drop, focus, format, key;
  16. static CategoryAttribute layout, mouse, window_style;
  17. public CategoryAttribute (string category)
  18. {
  19. this.category = category;
  20. }
  21. public CategoryAttribute ()
  22. {
  23. this.category = "Misc";
  24. }
  25. [MonoTODO]
  26. protected virtual string GetLocalizedString (string value)
  27. {
  28. // FIXME: IMPLEMENT
  29. return category;
  30. }
  31. public string Category {
  32. get {
  33. return category;
  34. }
  35. }
  36. public static CategoryAttribute Action {
  37. get {
  38. if (action != null)
  39. return action;
  40. lock (typeof (CategoryAttribute)){
  41. if (action == null)
  42. action = new CategoryAttribute ("Action");
  43. }
  44. return action;
  45. }
  46. }
  47. public static CategoryAttribute Appearance {
  48. get {
  49. if (appearance != null)
  50. return appearance;
  51. lock (typeof (CategoryAttribute)){
  52. if (appearance == null)
  53. appearance = new CategoryAttribute ("Appearance");
  54. }
  55. return appearance;
  56. }
  57. }
  58. public static CategoryAttribute Behaviour {
  59. get {
  60. if (behaviour != null)
  61. return behaviour;
  62. lock (typeof (CategoryAttribute)){
  63. if (behaviour == null)
  64. behaviour = new CategoryAttribute ("Action");
  65. }
  66. return behaviour;
  67. }
  68. }
  69. public static CategoryAttribute Data {
  70. get {
  71. if (data != null)
  72. return data;
  73. lock (typeof (CategoryAttribute)){
  74. if (data == null)
  75. data = new CategoryAttribute ("Data");
  76. }
  77. return data;
  78. }
  79. }
  80. public static CategoryAttribute Default {
  81. get {
  82. if (def != null)
  83. return def;
  84. lock (typeof (CategoryAttribute)){
  85. if (def == null)
  86. def = new CategoryAttribute ("Default");
  87. }
  88. return def;
  89. }
  90. }
  91. public static CategoryAttribute Design {
  92. get {
  93. if (design != null)
  94. return design;
  95. lock (typeof (CategoryAttribute)){
  96. if (design == null)
  97. design = new CategoryAttribute ("Design");
  98. }
  99. return design;
  100. }
  101. }
  102. public static CategoryAttribute DragDrop {
  103. get {
  104. if (drag_drop != null)
  105. return drag_drop;
  106. lock (typeof (CategoryAttribute)){
  107. if (drag_drop == null)
  108. drag_drop = new CategoryAttribute ("Drag Drop");
  109. }
  110. return drag_drop;
  111. }
  112. }
  113. public static CategoryAttribute Focus {
  114. get {
  115. if (focus != null)
  116. return focus;
  117. lock (typeof (CategoryAttribute)){
  118. if (focus == null)
  119. focus = new CategoryAttribute ("Focus");
  120. }
  121. return focus;
  122. }
  123. }
  124. public static CategoryAttribute Format {
  125. get {
  126. if (format != null)
  127. return format;
  128. lock (typeof (CategoryAttribute)){
  129. if (format == null)
  130. format = new CategoryAttribute ("Format");
  131. }
  132. return format;
  133. }
  134. }
  135. public static CategoryAttribute Key {
  136. get {
  137. if (key != null)
  138. return key;
  139. lock (typeof (CategoryAttribute)){
  140. if (key == null)
  141. key = new CategoryAttribute ("Key");
  142. }
  143. return key;
  144. }
  145. }
  146. public static CategoryAttribute Layout {
  147. get {
  148. if (layout != null)
  149. return layout;
  150. lock (typeof (CategoryAttribute)){
  151. if (layout == null)
  152. layout = new CategoryAttribute ("Layout");
  153. }
  154. return layout;
  155. }
  156. }
  157. public static CategoryAttribute Mouse {
  158. get {
  159. if (mouse != null)
  160. return mouse;
  161. lock (typeof (CategoryAttribute)){
  162. if (mouse == null)
  163. mouse = new CategoryAttribute ("Mouse");
  164. }
  165. return mouse;
  166. }
  167. }
  168. public static CategoryAttribute WindowStyle {
  169. get {
  170. if (window_style != null)
  171. return window_style;
  172. lock (typeof (CategoryAttribute)){
  173. if (window_style == null)
  174. window_style = new CategoryAttribute ("Window Style");
  175. }
  176. return window_style;
  177. }
  178. }
  179. }
  180. }