dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms AccessibleObjec


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms AccessibleObject.cs,1.1,1.2 Button.cs,1.3,1.4 Control.cs,1.9,1.10 Forms.build,1.1,1.2
Date: Fri, 13 Jun 2003 20:36:47 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms
In directory subversions:/tmp/cvs-serv10148/System.Windows.Forms

Modified Files:
        AccessibleObject.cs Button.cs Control.cs Forms.build 
Log Message:


Provide a default accessibility implementation for the "Control" class.


Index: AccessibleObject.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/AccessibleObject.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** AccessibleObject.cs 11 Jun 2003 07:07:19 -0000      1.1
--- AccessibleObject.cs 14 Jun 2003 00:36:44 -0000      1.2
***************
*** 25,36 ****
  #if !CONFIG_COMPACT_FORMS
  
! [TODO]
! public class AccessibleObject
  {
!       // TODO
  
  }; // class AccessibleObject
  
! #endif
  
  }; // namespace System.Windows.Forms
--- 25,499 ----
  #if !CONFIG_COMPACT_FORMS
  
! using System.Runtime.InteropServices;
! using System.Runtime.CompilerServices;
! using System.Drawing;
! using System.Reflection;
! using System.Globalization;
! using Accessibility;
! 
! #if !ECMA_COMPAT
! [ComVisible(true)]
! #endif
! public class AccessibleObject : MarshalByRefObject, IAccessible
! #if !ECMA_COMPAT
!       , IReflect
! #endif
  {
!       // Internal state.
!       private Control control;
!       private String value;
! 
!       // Extra storage fields that are used by "Control".
!       internal String defaultAction;
!       internal String description;
!       internal String name;
!       internal AccessibleRole role;
! 
!       // Constructor.
!       public AccessibleObject() : this(null) {}
!       internal AccessibleObject(Control control)
!                       {
!                               this.control = control;
!                               this.role = AccessibleRole.Default;
!                       }
! 
!       // Get or set this object's properties.
!       public virtual Rectangle Bounds
!                       {
!                               get
!                               {
!                                       if(control != null)
!                                       {
!                                               Control parent = control.Parent;
!                                               if(parent != null)
!                                               {
!                                                       return 
parent.RectangleToScreen(control.Bounds);
!                                               }
!                                               else
!                                               {
!                                                       return control.Bounds;
!                                               }
!                                       }
!                                       return Rectangle.Empty;
!                               }
!                       }
!       public virtual String DefaultAction
!                       {
!                               get
!                               {
!                                       if(control != null)
!                                       {
!                                               return 
control.AccessibleDefaultActionDescription;
!                                       }
!                                       return null;
!                               }
!                       }
!       public virtual String Description
!                       {
!                               get
!                               {
!                                       if(control != null)
!                                       {
!                                               return 
control.AccessibleDescription;
!                                       }
!                                       return null;
!                               }
!                       }
!       public virtual String Help
!                       {
!                               get
!                               {
!                                       if(control != null)
!                                       {
!                                               return 
control.GetAccessibilityHelp();
!                                       }
!                                       return null;
!                               }
!                       }
!       public virtual String KeyboardShortcut
!                       {
!                               get
!                               {
!                                       if(control != null)
!                                       {
!                                               return 
control.GetKeyboardShortcut();
!                                       }
!                                       return null;
!                               }
!                       }
!       public virtual String Name
!                       {
!                               get
!                               {
!                                       if(control != null)
!                                       {
!                                               return control.AccessibleName;
!                                       }
!                                       else
!                                       {
!                                               return null;
!                                       }
!                               }
!                               set
!                               {
!                                       if(control != null)
!                                       {
!                                               control.AccessibleName = value;
!                                       }
!                               }
!                       }
!       public virtual AccessibleObject Parent
!                       {
!                               get
!                               {
!                                       if(control != null)
!                                       {
!                                               Control parent = control.Parent;
!                                               if(parent != null)
!                                               {
!                                                       return 
parent.AccessibilityObject;
!                                               }
!                                       }
!                                       return null;
!                               }
!                       }
!       public virtual AccessibleRole Role
!                       {
!                               get
!                               {
!                                       if(control != null)
!                                       {
!                                               return control.AccessibleRole;
!                                       }
!                                       return AccessibleRole.None;
!                               }
!                       }
!       public virtual AccessibleStates State
!                       {
!                               get
!                               {
!                                       return AccessibleStates.None;
!                               }
!                       }
!       public virtual String Value
!                       {
!                               get
!                               {
!                                       return value;
!                               }
!                               set
!                               {
!                                       this.value = value;
!                               }
!                       }
! 
!       // Perform the default action associated with this object.
!       public virtual void DoDefaultAction()
!                       {
!                               if(control != null)
!                               {
!                                       control.DoDefaultAction();
!                               }
!                       }
! 
!       // Get the accessible object for a specific child.
!       public virtual AccessibleObject GetChild(int index)
!                       {
!                               if(control != null)
!                               {
!                                       Control child = 
control.GetChildByIndex(index);
!                                       if(child != null)
!                                       {
!                                               return 
child.AccessibilityObject;
!                                       }
!                               }
!                               return null;
!                       }
! 
!       // Get the number of children.
!       public virtual int GetChildCount()
!                       {
!                               if(control != null)
!                               {
!                                       return control.GetNumChildren();
!                               }
!                               return -1;
!                       }
! 
!       // Get the accessible object for the focused control.
!       public virtual AccessibleObject GetFocused()
!                       {
!                               if(control != null)
!                               {
!                                       Control child = 
control.GetFocusedChild();
!                                       if(child != null)
!                                       {
!                                               return 
child.AccessibilityObject;
!                                       }
!                               }
!                               return null;
!                       }
! 
!       // Get the help topic for this accessible object.
!       public virtual int GetHelpTopic(out String fileName)
!                       {
!                               if(control != null)
!                               {
!                                       return control.GetHelpTopic(out 
fileName);
!                               }
!                               fileName = null;
!                               return -1;
!                       }
! 
!       // Get the currently selected child.
!       public virtual AccessibleObject GetSelected()
!                       {
!                               if(control != null)
!                               {
!                                       Control child = 
control.GetSelectedChild();
!                                       if(child != null)
!                                       {
!                                               return 
child.AccessibilityObject;
!                                       }
!                               }
!                               return null;
!                       }
! 
!       // Perform a screen co-ordinate hit test to find a child.
!       public virtual AccessibleObject HitTest(int x, int y)
!                       {
!                               return null;
!                       }
! 
!       // Navigate to another object from this one.
!       public virtual AccessibleObject Navigate(AccessibleNavigation navdir)
!                       {
!                               return null;
!                       }
! 
!       // Select this accessible object.
!       public virtual void Select(AccessibleSelection flags)
!                       {
!                               // Nothing to do here.
!                       }
! 
!       // Stub out the IAccessible implementation, which we don't use.
!       // It is peculiar to Microsoft's COM implementation of accessibility.
!       void IAccessible.accDoDefaultAction(out Object varChild)
!                       {
!                               throw new NotImplementedException();
!                       }
!       Object IAccessible.accHitTest(int xLeft, int yTop)
!                       {
!                               throw new NotImplementedException();
!                       }
!       void IAccessible.accLocation
!                               (out int pxLeft, out int pyTop,
!                                out int pcxWidth, out int pcyHeight,
!                                Object varChild)
!                       {
!                               throw new NotImplementedException();
!                       }
!       Object IAccessible.accNavigate(int navDir, Object varStart)
!                       {
!                               throw new NotImplementedException();
!                       }
!       void IAccessible.accSelect(int flagsSelect, Object varChild)
!                       {
!                               throw new NotImplementedException();
!                       }
!       [IndexerName("accChild")]
!       Object IAccessible.this[Object varChild]
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
!       int IAccessible.accChildCount
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
!       Object IAccessible.accFocus
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
!       Object IAccessible.accParent
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
!       Object IAccessible.accSelection
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
!       [IndexerName("accDefaultAction")]
!       String IAccessible.this[Object varChild]
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
!       [IndexerName("accDescription")]
!       String IAccessible.this[Object varChild]
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
!       [IndexerName("accHelp")]
!       String IAccessible.this[Object varChild]
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
!       [IndexerName("accHelpTopic")]
!       int IAccessible.this[out String pszHelp, Object varChild]
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
!       [IndexerName("accKeyboardShortcut")]
!       String IAccessible.this[Object varChild]
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
!       [IndexerName("accName")]
!       String IAccessible.this[Object varChild]
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                               set
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
!       [IndexerName("accRole")]
!       Object IAccessible.this[Object varChild]
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                               set
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
!       [IndexerName("accState")]
!       Object IAccessible.this[Object varChild]
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                               set
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
!       [IndexerName("accValue")]
!       String IAccessible.this[Object varChild]
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                               set
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
! 
! #if !ECMA_COMPAT
! 
!       // Stub out the IReflect implementation, which we don't use.
!       // It is peculiar to Microsoft's COM implementation of accessibility.
!       FieldInfo IReflect.GetField(String name, BindingFlags bindingAttr)
!                       {
!                               throw new NotImplementedException();
!                       }
!       FieldInfo[] IReflect.GetFields(BindingFlags bindingAttr)
!                       {
!                               throw new NotImplementedException();
!                       }
!       MemberInfo[] IReflect.GetMember(String name, BindingFlags bindingAttr)
!                       {
!                               throw new NotImplementedException();
!                       }
!       MemberInfo[] IReflect.GetMembers(BindingFlags bindingAttr)
!                       {
!                               throw new NotImplementedException();
!                       }
!       MethodInfo IReflect.GetMethod(String name, BindingFlags bindingAttr)
!                       {
!                               throw new NotImplementedException();
!                       }
!       MethodInfo IReflect.GetMethod(String name, BindingFlags bindingAttr,
!                                                Binder binder, Type[] types,
!                                                ParameterModifier[] modifiers)
!                       {
!                               throw new NotImplementedException();
!                       }
!       MethodInfo[] IReflect.GetMethods(BindingFlags bindingAttr)
!                       {
!                               throw new NotImplementedException();
!                       }
!       PropertyInfo IReflect.GetProperty(String name, BindingFlags bindingAttr)
!                       {
!                               throw new NotImplementedException();
!                       }
!       PropertyInfo IReflect.GetProperty(String name, BindingFlags bindingAttr,
!                                                        Binder binder, Type 
returnType,
!                                                        Type[] types, 
ParameterModifier[] modifiers)
!                       {
!                               throw new NotImplementedException();
!                       }
!       PropertyInfo[] IReflect.GetProperties(BindingFlags bindingAttr)
!                       {
!                               throw new NotImplementedException();
!                       }
!       Object IReflect.InvokeMember(String name, BindingFlags invokeAttr,
!                                               Binder binder, Object target, 
Object[] args,
!                                               ParameterModifier[] modifiers,
!                                               CultureInfo culture, String[] 
namedParameters)
!                       {
!                               throw new NotImplementedException();
!                       }
!       Type IReflect.UnderlyingSystemType
!                       {
!                               get
!                               {
!                                       throw new NotImplementedException();
!                               }
!                       }
! 
! #endif // !ECMA_COMPAT
  
  }; // class AccessibleObject
  
! #endif // !CONFIG_COMPACT_FORMS
  
  }; // namespace System.Windows.Forms

Index: Button.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Button.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Button.cs   13 Jun 2003 21:55:56 -0000      1.3
--- Button.cs   14 Jun 2003 00:36:44 -0000      1.4
***************
*** 118,121 ****
--- 118,127 ----
                        }
  
+       // Perform the default accessibility action for this control.
+       internal override void DoDefaultAction()
+                       {
+                               PerformClick();
+                       }
+ 
  }; // class Button
  

Index: Control.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Control.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** Control.cs  13 Jun 2003 21:55:56 -0000      1.9
--- Control.cs  14 Jun 2003 00:36:44 -0000      1.10
***************
*** 65,68 ****
--- 65,71 ----
        private CreateParams createParams;
        private static Font defaultFont;
+ #if !CONFIG_COMPACT_FORMS
+       private AccessibleObject accessibilityObject;
+ #endif
  
        // Constructors.
***************
*** 188,250 ****
        // Get or set the control's properties.
  #if !CONFIG_COMPACT_FORMS
-       [TODO]
        public AccessibleObject AccessibilityObject
                        {
                                get
                                {
!                                       // TODO
!                                       return null;
                                }
                        }
-       [TODO]
        public String AccessibleDefaultActionDescription
                        {
                                get
                                {
!                                       // TODO
!                                       return null;
                                }
                                set
                                {
!                                       // TODO
                                }
                        }
-       [TODO]
        public String AccessibleDescription
                        {
                                get
                                {
!                                       // TODO
!                                       return null;
                                }
                                set
                                {
!                                       // TODO
                                }
                        }
-       [TODO]
        public String AccessibleName
                        {
                                get
                                {
!                                       // TODO
!                                       return null;
                                }
                                set
                                {
!                                       // TODO
                                }
                        }
-       [TODO]
        public AccessibleRole AccessibleRole
                        {
                                get
                                {
!                                       // TODO
!                                       return AccessibleRole.Default;
                                }
                                set
                                {
!                                       // TODO
                                }
                        }
--- 191,247 ----
        // Get or set the control's properties.
  #if !CONFIG_COMPACT_FORMS
        public AccessibleObject AccessibilityObject
                        {
                                get
                                {
!                                       if(accessibilityObject == null)
!                                       {
!                                               accessibilityObject = 
CreateAccessibilityInstance();
!                                       }
!                                       return accessibilityObject;
                                }
                        }
        public String AccessibleDefaultActionDescription
                        {
                                get
                                {
!                                       return 
AccessibilityObject.defaultAction;
                                }
                                set
                                {
!                                       AccessibilityObject.defaultAction = 
value;
                                }
                        }
        public String AccessibleDescription
                        {
                                get
                                {
!                                       return AccessibilityObject.description;
                                }
                                set
                                {
!                                       AccessibilityObject.description = value;
                                }
                        }
        public String AccessibleName
                        {
                                get
                                {
!                                       return AccessibilityObject.name;
                                }
                                set
                                {
!                                       AccessibilityObject.name = value;
                                }
                        }
        public AccessibleRole AccessibleRole
                        {
                                get
                                {
!                                       return AccessibilityObject.role;
                                }
                                set
                                {
!                                       AccessibilityObject.role = value;
                                }
                        }
***************
*** 781,795 ****
                                }
                        }
-       [TODO]
        public bool IsAccessible
                        {
                                get
                                {
!                                       // TODO
!                                       return false;
                                }
                                set
                                {
!                                       // TODO
                                }
                        }
--- 778,791 ----
                                }
                        }
        public bool IsAccessible
                        {
                                get
                                {
!                                       // By default, we assume that 
everything is accessible.
!                                       return true;
                                }
                                set
                                {
!                                       // Not used in this implementation.
                                }
                        }
***************
*** 1238,1254 ****
  
        // Notify client applications of accessibility events.
-       [TODO]
        protected void AccessibilityNotifyClients
                                (AccessibleEvents accEvent, int childID)
                        {
!                               // TODO
                        }
  
        // Create the accessibility object for this control.
-       [TODO]
        protected virtual AccessibleObject CreateAccessibilityInstance()
                        {
!                               // TODO
!                               return null;
                        }
  
--- 1234,1247 ----
  
        // Notify client applications of accessibility events.
        protected void AccessibilityNotifyClients
                                (AccessibleEvents accEvent, int childID)
                        {
!                               // Not used in this implementation.
                        }
  
        // Create the accessibility object for this control.
        protected virtual AccessibleObject CreateAccessibilityInstance()
                        {
!                               return new AccessibleObject(this);
                        }
  
***************
*** 4118,4121 ****
--- 4111,4183 ----
                                return new SolidBrush(BackColor);
                        }
+ 
+ #if !CONFIG_COMPACT_FORMS
+ 
+       // Methods that support "AccessibleObject".
+ 
+       // Get the accessibility help information.
+       internal String GetAccessibilityHelp()
+                       {
+                               QueryAccessibilityHelpEventArgs e;
+                               e = new QueryAccessibilityHelpEventArgs();
+                               OnQueryAccessibilityHelp(e);
+                               return e.HelpString;
+                       }
+ 
+       // Get the number of children underneath this control.
+       internal int GetNumChildren()
+                       {
+                               return numChildren;
+                       }
+ 
+       // Get a specific child by index.
+       internal Control GetChildByIndex(int index)
+                       {
+                               if(index >= 0 && index < numChildren)
+                               {
+                                       return children[index];
+                               }
+                               else
+                               {
+                                       return null;
+                               }
+                       }
+ 
+       // Get the focused child, or this control if it has focus.
+       [TODO]
+       internal Control GetFocusedChild()
+                       {
+                               // TODO
+                               return null;
+                       }
+ 
+       // Get the selected child, or this control if it is selected.
+       [TODO]
+       internal Control GetSelectedChild()
+                       {
+                               // TODO
+                               return null;
+                       }
+ 
+       // Get the keyboard shortcut.
+       internal virtual String GetKeyboardShortcut()
+                       {
+                               return null;
+                       }
+ 
+       // Perform the default accessibility action for this control.
+       internal virtual void DoDefaultAction()
+                       {
+                               // Nothing to do here.
+                       }
+ 
+       // Get the help topic for this accessible object.
+       internal virtual int GetHelpTopic(out String fileName)
+                       {
+                               fileName = null;
+                               return -1;
+                       }
+ 
+ #endif // !CONFIG_COMPACT_FORMS
  
  }; // class Control

Index: Forms.build
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Forms.build,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Forms.build 11 Jun 2003 07:07:19 -0000      1.1
--- Forms.build 14 Jun 2003 00:36:44 -0000      1.2
***************
*** 23,26 ****
--- 23,27 ----
                                <file name="../System/System.dll"/>
                                <file name="../DotGNU.SSL/DotGNU.SSL.dll"/>
+                               <file name="../compat/Accessibility.dll"/>
                                <file name="../runtime/mscorlib.dll"/>
                        </references>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]