AccessibleObject.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. //
  2. // System.Windows.Forms.AccessibleObject.cs
  3. //
  4. // Author:
  5. // stubbed out by Jaak Simm ([email protected])
  6. // Dennis Hayes ([email protected])
  7. // (C) 2002 Ximian, Inc
  8. //
  9. using System;
  10. using System.Reflection;
  11. using System.Globalization;
  12. //using System.Windows.Forms.AccessibleObject.IAccessible;
  13. using System.Drawing;
  14. using Accessibility;
  15. using System.Runtime.InteropServices;
  16. namespace System.Windows.Forms {
  17. /// <summary>
  18. /// Provides information that accessibility applications use to adjust an application's UI for users with impairments.
  19. ///
  20. /// ToDo note:
  21. /// - Nothing is implemented
  22. /// - IAccessible members not stubbed out
  23. /// - MarshalByRefObject members not stubbed out
  24. /// MSDN gives little info on the members of IAccessible: "This member supports the .NET Framework infrastructure and is not intended to be used directly from your code."
  25. /// </summary>
  26. [MonoTODO]
  27. [ComVisible(true)]
  28. public class AccessibleObject : MarshalByRefObject, IReflect, IAccessible {
  29. private string defaultAction;
  30. private string description;
  31. private string help;
  32. private string keyboardShortcut;
  33. private AccessibleObject parent;
  34. private AccessibleRole role;
  35. private AccessibleStates state;
  36. private string name;
  37. private string value;
  38. // --- Constructor ---
  39. [MonoTODO]
  40. public AccessibleObject() {
  41. name = null;
  42. parent = null;
  43. role = AccessibleRole.None;
  44. state = AccessibleStates.None;
  45. value = null;
  46. }
  47. [MonoTODO]
  48. ~AccessibleObject(){
  49. }
  50. /// <summary>
  51. /// Equals Method
  52. /// </summary>
  53. ///
  54. /// <remarks>
  55. /// Checks equivalence of this AccessibleObject and another object.
  56. /// </remarks>
  57. public override bool Equals (object obj) {
  58. if (!(obj is AccessibleObject))
  59. return false;
  60. return (this == (AccessibleObject) obj);
  61. }
  62. /// <summary>
  63. /// GetHashCode Method
  64. /// </summary>
  65. ///
  66. /// <remarks>
  67. /// Calculates a hashing value.
  68. /// </remarks>
  69. public override int GetHashCode () {
  70. //unchecked{//FIXME Add out proprities to the hash
  71. return base.GetHashCode();
  72. //}
  73. }
  74. /// <summary>
  75. /// ToString Method
  76. /// </summary>
  77. ///
  78. /// <remarks>
  79. /// Formats the AccessibleObject as a string.
  80. /// </remarks>
  81. //spec says inherited
  82. //public override string ToString () {
  83. // return "AccessibleObject".GetType();//per spec as I read it?
  84. //}
  85. // --- Properties ---
  86. [ComVisible(true)]
  87. public virtual Rectangle Bounds {
  88. get { return Rectangle.Empty; } // As per spec for default. Expect override.
  89. }
  90. [ComVisible(true)]
  91. public virtual string DefaultAction {
  92. get {return null; }// As per spec for default. Expect override.
  93. }
  94. [ComVisible(true)]
  95. public virtual string Description {
  96. get {return null; }// As per spec for default. Expect override.
  97. }
  98. [ComVisible(true)]
  99. public virtual string Help {
  100. get {return null; }// As per spec for default. Expect override.
  101. }
  102. [ComVisible(true)]
  103. public virtual string KeyboardShortcut {
  104. get {return null; }// As per spec for default. Expect override.
  105. }
  106. [ComVisible(true)]
  107. public virtual string Name {
  108. get { return name; }
  109. set { name = value; }
  110. }
  111. [ComVisible(true)]
  112. public virtual string Value {
  113. get { return this.value; }
  114. set { this.value = value; }
  115. }
  116. [ComVisible(true)]
  117. public virtual AccessibleObject Parent {
  118. get { return parent; }
  119. set { parent = value; }
  120. }
  121. [ComVisible(true)]
  122. public virtual AccessibleRole Role {
  123. get { return role; }
  124. set { role = value; }
  125. }
  126. [ComVisible(true)]
  127. public virtual AccessibleStates State {
  128. get { return state; }
  129. set { state = value; }
  130. }
  131. // --- Methods ---
  132. [ComVisible(true)]
  133. public virtual void DoDefaultAction() {
  134. return; //default action is "" and cannot be changed, must be overridden.
  135. }
  136. [ComVisible(true)]
  137. public virtual AccessibleObject GetChild(int index) {
  138. return null;
  139. }
  140. [ComVisible(true)]
  141. public virtual int GetChildCount() {
  142. return -1; //as per spec
  143. }
  144. [MonoTODO]
  145. [ComVisible(true)]
  146. public virtual AccessibleObject GetFocused() {
  147. return null;//FIXME: not quite to spec.
  148. }
  149. [ComVisible(true)]
  150. public virtual int GetHelpTopic(out string fileName) {
  151. fileName = "";
  152. return -1;//no help
  153. }
  154. [ComVisible(true)]
  155. public virtual AccessibleObject GetSelected() {
  156. return null;
  157. }
  158. [MonoTODO]
  159. [ComVisible(true)]
  160. public virtual AccessibleObject HitTest(int x,int y) {
  161. return null; }
  162. [MonoTODO]
  163. [ComVisible(true)]
  164. public virtual AccessibleObject Navigate(AccessibleNavigation navdir) {
  165. //by default, navagate back to here. Does this work?
  166. //not to spec, but better than execption FIXME:
  167. return this;
  168. }
  169. [MonoTODO]
  170. [ComVisible(true)]
  171. public virtual void Select(AccessibleSelection flags) {
  172. return;//FIXME: Not to spec. should be over ridden anyway.
  173. }
  174. //Not part of spec?
  175. //[MonoTODO]
  176. //[ComVisible(true)]
  177. //protected void UseStdAccessibleObjects(IntPtr handle,int objid)
  178. //{
  179. // throw new NotImplementedException ();
  180. //}
  181. // --- Methods: IReflect ---
  182. [MonoTODO]
  183. FieldInfo IReflect.GetField( string name,BindingFlags bindingAttr) {
  184. // FIXME
  185. throw new NotImplementedException ();
  186. }
  187. [MonoTODO]
  188. FieldInfo[] IReflect.GetFields (BindingFlags bindingAttr) {
  189. // FIXME
  190. throw new NotImplementedException ();
  191. }
  192. [MonoTODO]
  193. MemberInfo[] IReflect.GetMember( string name, BindingFlags bindingAttr) {
  194. // FIXME
  195. throw new NotImplementedException ();
  196. }
  197. [MonoTODO]
  198. MemberInfo[] IReflect.GetMembers( BindingFlags bindingAttr) {
  199. // FIXME
  200. throw new NotImplementedException ();
  201. }
  202. [MonoTODO]
  203. MethodInfo IReflect.GetMethod( string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) {
  204. // FIXME
  205. throw new NotImplementedException ();
  206. }
  207. [MonoTODO]
  208. MethodInfo IReflect.GetMethod( string name, BindingFlags bindingAttr) {
  209. // FIXME
  210. throw new NotImplementedException ();
  211. }
  212. [MonoTODO]
  213. MethodInfo[] IReflect.GetMethods( BindingFlags bindingAttr) {
  214. // FIXME
  215. throw new NotImplementedException ();
  216. }
  217. [MonoTODO]
  218. PropertyInfo[] IReflect.GetProperties( BindingFlags bindingAttr) {
  219. // FIXME
  220. throw new NotImplementedException ();
  221. }
  222. [MonoTODO]
  223. PropertyInfo IReflect.GetProperty( string name, BindingFlags bindingAttr) {
  224. // FIXME
  225. throw new NotImplementedException ();
  226. }
  227. [MonoTODO]
  228. PropertyInfo IReflect.GetProperty( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
  229. // FIXME
  230. throw new NotImplementedException ();
  231. }
  232. [MonoTODO]
  233. //[Guid("")]
  234. object IReflect.InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
  235. // FIXME
  236. throw new NotImplementedException ();
  237. }
  238. Type IReflect.UnderlyingSystemType {
  239. //private Type UnderlyingSystemType {
  240. get { throw new NotImplementedException (); }
  241. }
  242. void IAccessible.accDoDefaultAction(object childID) {
  243. throw new NotImplementedException ();
  244. }
  245. int IAccessible.accChildCount{
  246. get{
  247. throw new NotImplementedException ();
  248. }
  249. }
  250. object IAccessible.accFocus{
  251. get{
  252. throw new NotImplementedException ();
  253. }
  254. }
  255. object IAccessible.accHitTest(int xLeft, int yTop) {
  256. throw new NotImplementedException ();
  257. }
  258. void IAccessible.accLocation(out int pxLeft, out int pyTop, out int pcxWidth, out int pcyHeight, object childID) {
  259. throw new NotImplementedException ();
  260. }
  261. object IAccessible.accNavigate(int navDir, object childID) {
  262. throw new NotImplementedException ();
  263. }
  264. object IAccessible.accParent {
  265. get{
  266. throw new NotImplementedException ();
  267. }
  268. }
  269. void IAccessible.accSelect(int flagsSelect, object childID) {
  270. throw new NotImplementedException ();
  271. }
  272. object IAccessible.accSelection {
  273. get{
  274. throw new NotImplementedException ();
  275. }
  276. }
  277. object IAccessible.get_accChild(object childID) {
  278. throw new NotImplementedException ();
  279. }
  280. string IAccessible.get_accDefaultAction(object childID) {
  281. throw new NotImplementedException ();
  282. }
  283. string IAccessible.get_accDescription(object childID) {
  284. throw new NotImplementedException ();
  285. }
  286. string IAccessible.get_accHelp(object childID) {
  287. throw new NotImplementedException ();
  288. }
  289. int IAccessible.get_accHelpTopic(out string pszHelpFile,object childID) {
  290. throw new NotImplementedException ();
  291. }
  292. string IAccessible.get_accKeyboardShortcut(object childID) {
  293. throw new NotImplementedException ();
  294. }
  295. string IAccessible.get_accName(object childID) {
  296. throw new NotImplementedException ();
  297. }
  298. object IAccessible.get_accRole(object childID) {
  299. throw new NotImplementedException ();
  300. }
  301. object IAccessible.get_accState(object childID) {
  302. throw new NotImplementedException ();
  303. }
  304. string IAccessible.get_accValue(object childID) {
  305. throw new NotImplementedException ();
  306. }
  307. void IAccessible.set_accName(object childID, string newName) {
  308. throw new NotImplementedException ();
  309. }
  310. void IAccessible.set_accValue(object childID, string newValue) {
  311. throw new NotImplementedException ();
  312. }
  313. }
  314. }