AccessibleObject.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. // Permission is hereby granted, free of charge, to any person obtaining
  2. // a copy of this software and associated documentation files (the
  3. // "Software"), to deal in the Software without restriction, including
  4. // without limitation the rights to use, copy, modify, merge, publish,
  5. // distribute, sublicense, and/or sell copies of the Software, and to
  6. // permit persons to whom the Software is furnished to do so, subject to
  7. // the following conditions:
  8. //
  9. // The above copyright notice and this permission notice shall be
  10. // included in all copies or substantial portions of the Software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  15. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  16. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  17. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  18. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19. //
  20. // Copyright (c) 2004 Novell, Inc.
  21. //
  22. // Authors:
  23. // Peter Bartok [email protected]
  24. //
  25. //
  26. // $Log: AccessibleObject.cs,v $
  27. // Revision 1.2 2004/08/11 13:44:33 pbartok
  28. // - Fixed to match ControlCollection rewrite
  29. //
  30. // Revision 1.1 2004/07/09 05:21:25 pbartok
  31. // - Initial check-in
  32. //
  33. //
  34. // NOT COMPLETE
  35. using Accessibility;
  36. using System.Drawing;
  37. using System.Globalization;
  38. using System.Reflection;
  39. namespace System.Windows.Forms {
  40. public class AccessibleObject : MarshalByRefObject, IReflect, IAccessible {
  41. #region Private Variables
  42. private string name;
  43. private string value;
  44. private Control owner;
  45. internal AccessibleRole role;
  46. internal string default_action;
  47. internal string description;
  48. internal string help;
  49. internal string keyboard_shortcut;
  50. #endregion // Private Variables
  51. #region Public Constructors
  52. public AccessibleObject() {
  53. this.owner=null;
  54. this.value=null;
  55. this.name=null;
  56. this.role=AccessibleRole.Default;
  57. this.default_action=null;
  58. this.description=null;
  59. this.help=null;
  60. this.keyboard_shortcut=null;
  61. }
  62. #endregion // Public Constructors
  63. #region Private Constructors
  64. internal AccessibleObject(Control owner) : this () {
  65. this.owner=owner;
  66. }
  67. #endregion // Private Constructors
  68. #region Public Instance Properties
  69. public virtual Rectangle Bounds {
  70. get {
  71. return Rectangle.Empty;
  72. }
  73. }
  74. public virtual string DefaultAction {
  75. get {
  76. return default_action;
  77. }
  78. }
  79. public virtual string Description {
  80. get {
  81. return description;
  82. }
  83. }
  84. public virtual string Help {
  85. get {
  86. return help;
  87. }
  88. }
  89. public virtual string KeyboardShortcut {
  90. get {
  91. return keyboard_shortcut;
  92. }
  93. }
  94. public virtual string Name {
  95. get {
  96. return name;
  97. }
  98. set {
  99. name=value;
  100. }
  101. }
  102. public virtual AccessibleObject Parent {
  103. get {
  104. if ((owner!=null) && (owner.Parent!=null)) {
  105. return owner.Parent.AccessibilityObject;
  106. }
  107. return null;
  108. }
  109. }
  110. public virtual AccessibleRole Role {
  111. get {
  112. return role;
  113. }
  114. }
  115. public virtual AccessibleStates State {
  116. get {
  117. AccessibleStates state=AccessibleStates.None;
  118. if (owner!=null) {
  119. if (owner.Focused) {
  120. state |= AccessibleStates.Focused;
  121. }
  122. if (!owner.Visible) {
  123. state |= AccessibleStates.Invisible;
  124. }
  125. }
  126. return state;
  127. }
  128. }
  129. public virtual string Value {
  130. get {
  131. return this.value;
  132. }
  133. set {
  134. this.value=value;
  135. }
  136. }
  137. #endregion // Public Instance Properties
  138. #region Public Instance Methods
  139. public virtual void DoDefaultAction() {
  140. if (owner!=null) {
  141. owner.DoDefaultAction();
  142. }
  143. }
  144. public virtual AccessibleObject GetChild(int index) {
  145. if (owner!=null) {
  146. if (index<owner.child_controls.Count) {
  147. return owner.child_controls[index].AccessibilityObject;
  148. }
  149. }
  150. return null;
  151. }
  152. public virtual int GetChildCount() {
  153. if (owner!=null) {
  154. return owner.child_controls.Count;
  155. }
  156. return -1;
  157. }
  158. #endregion // Public Instance Methods
  159. #region IReflection Methods and Properties
  160. FieldInfo IReflect.GetField(String name, BindingFlags bindingAttr) {
  161. throw new NotImplementedException();
  162. }
  163. FieldInfo[] IReflect.GetFields(BindingFlags bindingAttr) {
  164. throw new NotImplementedException();
  165. }
  166. MemberInfo[] IReflect.GetMember(String name, BindingFlags bindingAttr) {
  167. throw new NotImplementedException();
  168. }
  169. MemberInfo[] IReflect.GetMembers(BindingFlags bindingAttr) {
  170. throw new NotImplementedException();
  171. }
  172. MethodInfo IReflect.GetMethod(String name, BindingFlags bindingAttr) {
  173. throw new NotImplementedException();
  174. }
  175. MethodInfo IReflect.GetMethod(String name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) {
  176. throw new NotImplementedException();
  177. }
  178. MethodInfo[] IReflect.GetMethods(BindingFlags bindingAttr) {
  179. throw new NotImplementedException();
  180. }
  181. PropertyInfo IReflect.GetProperty(String name, BindingFlags bindingAttr) {
  182. throw new NotImplementedException();
  183. }
  184. PropertyInfo IReflect.GetProperty(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
  185. throw new NotImplementedException();
  186. }
  187. PropertyInfo[] IReflect.GetProperties(BindingFlags bindingAttr) {
  188. throw new NotImplementedException();
  189. }
  190. Object IReflect.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) {
  191. throw new NotImplementedException();
  192. }
  193. Type IReflect.UnderlyingSystemType {
  194. get {
  195. throw new NotImplementedException();
  196. }
  197. }
  198. #endregion // IReflection Methods and Properties
  199. #region IAccessible Methods and Properties
  200. void IAccessible.accDoDefaultAction(object childID) {
  201. throw new NotImplementedException();
  202. }
  203. int IAccessible.accChildCount {
  204. get {
  205. throw new NotImplementedException();
  206. }
  207. }
  208. object IAccessible.accFocus {
  209. get {
  210. throw new NotImplementedException();
  211. }
  212. }
  213. object IAccessible.accHitTest(int xLeft, int yTop) {
  214. throw new NotImplementedException();
  215. }
  216. void IAccessible.accLocation(out int pxLeft, out int pyTop, out int pcxWidth, out int pcyHeight, object childID) {
  217. throw new NotImplementedException();
  218. }
  219. object IAccessible.accNavigate(int navDir, object childID) {
  220. throw new NotImplementedException();
  221. }
  222. object IAccessible.accParent {
  223. get {
  224. throw new NotImplementedException();
  225. }
  226. }
  227. void IAccessible.accSelect(int flagsSelect, object childID) {
  228. throw new NotImplementedException();
  229. }
  230. object IAccessible.accSelection {
  231. get {
  232. throw new NotImplementedException();
  233. }
  234. }
  235. object IAccessible.get_accChild(object childID) {
  236. throw new NotImplementedException();
  237. }
  238. string IAccessible.get_accDefaultAction(object childID) {
  239. throw new NotImplementedException();
  240. }
  241. string IAccessible.get_accDescription(object childID) {
  242. throw new NotImplementedException();
  243. }
  244. string IAccessible.get_accHelp(object childID) {
  245. throw new NotImplementedException();
  246. }
  247. int IAccessible.get_accHelpTopic(out string pszHelpFile,object childID) {
  248. throw new NotImplementedException();
  249. }
  250. string IAccessible.get_accKeyboardShortcut(object childID) {
  251. throw new NotImplementedException();
  252. }
  253. string IAccessible.get_accName(object childID) {
  254. throw new NotImplementedException();
  255. }
  256. object IAccessible.get_accRole(object childID) {
  257. throw new NotImplementedException();
  258. }
  259. object IAccessible.get_accState(object childID) {
  260. throw new NotImplementedException();
  261. }
  262. string IAccessible.get_accValue(object childID) {
  263. throw new NotImplementedException();
  264. }
  265. void IAccessible.set_accName(object childID, string newName) {
  266. throw new NotImplementedException();
  267. }
  268. void IAccessible.set_accValue(object childID, string newValue) {
  269. throw new NotImplementedException();
  270. }
  271. #endregion // IAccessible Methods and Properties
  272. }
  273. }