AccessibleObject.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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. // $Revision: 1.1 $
  27. // $Modtime: $
  28. // $Log: AccessibleObject.cs,v $
  29. // Revision 1.1 2004/07/09 05:21:25 pbartok
  30. // - Initial check-in
  31. //
  32. //
  33. // NOT COMPLETE
  34. using Accessibility;
  35. using System.Drawing;
  36. using System.Globalization;
  37. using System.Reflection;
  38. namespace System.Windows.Forms {
  39. public class AccessibleObject : MarshalByRefObject, IReflect, IAccessible {
  40. #region Private Variables
  41. private string name;
  42. private string value;
  43. private Control owner;
  44. internal AccessibleRole role;
  45. internal string default_action;
  46. internal string description;
  47. internal string help;
  48. internal string keyboard_shortcut;
  49. #endregion // Private Variables
  50. #region Public Constructors
  51. public AccessibleObject() {
  52. this.owner=null;
  53. this.value=null;
  54. this.name=null;
  55. this.role=AccessibleRole.Default;
  56. this.default_action=null;
  57. this.description=null;
  58. this.help=null;
  59. this.keyboard_shortcut=null;
  60. }
  61. #endregion // Public Constructors
  62. #region Private Constructors
  63. internal AccessibleObject(Control owner) : this () {
  64. this.owner=owner;
  65. }
  66. #endregion // Private Constructors
  67. #region Public Instance Properties
  68. public virtual Rectangle Bounds {
  69. get {
  70. return Rectangle.Empty;
  71. }
  72. }
  73. public virtual string DefaultAction {
  74. get {
  75. return default_action;
  76. }
  77. }
  78. public virtual string Description {
  79. get {
  80. return description;
  81. }
  82. }
  83. public virtual string Help {
  84. get {
  85. return help;
  86. }
  87. }
  88. public virtual string KeyboardShortcut {
  89. get {
  90. return keyboard_shortcut;
  91. }
  92. }
  93. public virtual string Name {
  94. get {
  95. return name;
  96. }
  97. set {
  98. name=value;
  99. }
  100. }
  101. public virtual AccessibleObject Parent {
  102. get {
  103. if ((owner!=null) && (owner.Parent!=null)) {
  104. return owner.Parent.AccessibilityObject;
  105. }
  106. return null;
  107. }
  108. }
  109. public virtual AccessibleRole Role {
  110. get {
  111. return role;
  112. }
  113. }
  114. public virtual AccessibleStates State {
  115. get {
  116. AccessibleStates state=AccessibleStates.None;
  117. if (owner!=null) {
  118. if (owner.Focused) {
  119. state |= AccessibleStates.Focused;
  120. }
  121. if (!owner.Visible) {
  122. state |= AccessibleStates.Invisible;
  123. }
  124. }
  125. return state;
  126. }
  127. }
  128. public virtual string Value {
  129. get {
  130. return this.value;
  131. }
  132. set {
  133. this.value=value;
  134. }
  135. }
  136. #endregion // Public Instance Properties
  137. #region Public Instance Methods
  138. public virtual void DoDefaultAction() {
  139. if (owner!=null) {
  140. owner.DoDefaultAction();
  141. }
  142. }
  143. public virtual AccessibleObject GetChild(int index) {
  144. if (owner!=null) {
  145. if (index<owner.num_of_children) {
  146. return owner.children[index].AccessibilityObject;
  147. }
  148. }
  149. return null;
  150. }
  151. public virtual int GetChildCount() {
  152. if (owner!=null) {
  153. return owner.num_of_children;
  154. }
  155. return -1;
  156. }
  157. #endregion // Public Instance Methods
  158. #region IReflection Methods and Properties
  159. FieldInfo IReflect.GetField(String name, BindingFlags bindingAttr) {
  160. throw new NotImplementedException();
  161. }
  162. FieldInfo[] IReflect.GetFields(BindingFlags bindingAttr) {
  163. throw new NotImplementedException();
  164. }
  165. MemberInfo[] IReflect.GetMember(String name, BindingFlags bindingAttr) {
  166. throw new NotImplementedException();
  167. }
  168. MemberInfo[] IReflect.GetMembers(BindingFlags bindingAttr) {
  169. throw new NotImplementedException();
  170. }
  171. MethodInfo IReflect.GetMethod(String name, BindingFlags bindingAttr) {
  172. throw new NotImplementedException();
  173. }
  174. MethodInfo IReflect.GetMethod(String name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) {
  175. throw new NotImplementedException();
  176. }
  177. MethodInfo[] IReflect.GetMethods(BindingFlags bindingAttr) {
  178. throw new NotImplementedException();
  179. }
  180. PropertyInfo IReflect.GetProperty(String name, BindingFlags bindingAttr) {
  181. throw new NotImplementedException();
  182. }
  183. PropertyInfo IReflect.GetProperty(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) {
  184. throw new NotImplementedException();
  185. }
  186. PropertyInfo[] IReflect.GetProperties(BindingFlags bindingAttr) {
  187. throw new NotImplementedException();
  188. }
  189. Object IReflect.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) {
  190. throw new NotImplementedException();
  191. }
  192. Type IReflect.UnderlyingSystemType {
  193. get {
  194. throw new NotImplementedException();
  195. }
  196. }
  197. #endregion // IReflection Methods and Properties
  198. #region IAccessible Methods and Properties
  199. void IAccessible.accDoDefaultAction(object childID) {
  200. throw new NotImplementedException();
  201. }
  202. int IAccessible.accChildCount {
  203. get {
  204. throw new NotImplementedException();
  205. }
  206. }
  207. object IAccessible.accFocus {
  208. get {
  209. throw new NotImplementedException();
  210. }
  211. }
  212. object IAccessible.accHitTest(int xLeft, int yTop) {
  213. throw new NotImplementedException();
  214. }
  215. void IAccessible.accLocation(out int pxLeft, out int pyTop, out int pcxWidth, out int pcyHeight, object childID) {
  216. throw new NotImplementedException();
  217. }
  218. object IAccessible.accNavigate(int navDir, object childID) {
  219. throw new NotImplementedException();
  220. }
  221. object IAccessible.accParent {
  222. get {
  223. throw new NotImplementedException();
  224. }
  225. }
  226. void IAccessible.accSelect(int flagsSelect, object childID) {
  227. throw new NotImplementedException();
  228. }
  229. object IAccessible.accSelection {
  230. get {
  231. throw new NotImplementedException();
  232. }
  233. }
  234. object IAccessible.get_accChild(object childID) {
  235. throw new NotImplementedException();
  236. }
  237. string IAccessible.get_accDefaultAction(object childID) {
  238. throw new NotImplementedException();
  239. }
  240. string IAccessible.get_accDescription(object childID) {
  241. throw new NotImplementedException();
  242. }
  243. string IAccessible.get_accHelp(object childID) {
  244. throw new NotImplementedException();
  245. }
  246. int IAccessible.get_accHelpTopic(out string pszHelpFile,object childID) {
  247. throw new NotImplementedException();
  248. }
  249. string IAccessible.get_accKeyboardShortcut(object childID) {
  250. throw new NotImplementedException();
  251. }
  252. string IAccessible.get_accName(object childID) {
  253. throw new NotImplementedException();
  254. }
  255. object IAccessible.get_accRole(object childID) {
  256. throw new NotImplementedException();
  257. }
  258. object IAccessible.get_accState(object childID) {
  259. throw new NotImplementedException();
  260. }
  261. string IAccessible.get_accValue(object childID) {
  262. throw new NotImplementedException();
  263. }
  264. void IAccessible.set_accName(object childID, string newName) {
  265. throw new NotImplementedException();
  266. }
  267. void IAccessible.set_accValue(object childID, string newValue) {
  268. throw new NotImplementedException();
  269. }
  270. #endregion // IAccessible Methods and Properties
  271. }
  272. }