2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #ifndef AccessibilityUIElement_h
27 #define AccessibilityUIElement_h
29 #include <JavaScriptCore/JSObjectRef.h>
30 #include <wtf/Platform.h>
31 #include <wtf/Vector.h>
35 typedef id PlatformUIElement;
37 typedef struct objc_object* PlatformUIElement;
41 #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
44 #include <WebCore/COMPtr.h>
46 typedef COMPtr<IAccessible> PlatformUIElement;
49 typedef AtkObject* PlatformUIElement;
51 typedef void* PlatformUIElement;
54 class AccessibilityUIElement {
56 AccessibilityUIElement(PlatformUIElement);
57 AccessibilityUIElement(const AccessibilityUIElement&);
58 ~AccessibilityUIElement();
60 PlatformUIElement platformUIElement() { return m_element; }
62 static JSObjectRef makeJSAccessibilityUIElement(JSContextRef, const AccessibilityUIElement&);
64 bool isEqual(AccessibilityUIElement* otherElement) { return platformUIElement() == otherElement->platformUIElement(); }
66 void getLinkedUIElements(Vector<AccessibilityUIElement>&);
67 void getDocumentLinks(Vector<AccessibilityUIElement>&);
68 void getChildren(Vector<AccessibilityUIElement>&);
69 void getChildrenWithRange(Vector<AccessibilityUIElement>&, unsigned location, unsigned length);
71 AccessibilityUIElement elementAtPoint(int x, int y);
72 AccessibilityUIElement getChildAtIndex(unsigned);
74 AccessibilityUIElement titleUIElement();
75 AccessibilityUIElement parentElement();
77 // Methods - platform-independent implementations
78 JSStringRef allAttributes();
79 JSStringRef attributesOfLinkedUIElements();
80 JSStringRef attributesOfDocumentLinks();
81 JSStringRef attributesOfChildren();
82 JSStringRef parameterizedAttributeNames();
87 // Attributes - platform-independent implementations
88 JSStringRef attributeValue(JSStringRef attribute);
89 bool isAttributeSettable(JSStringRef attribute);
90 bool isActionSupported(JSStringRef action);
92 JSStringRef subrole();
94 JSStringRef description();
95 JSStringRef language();
96 JSStringRef stringValue();
97 JSStringRef accessibilityValue() const;
105 JSStringRef valueDescription();
106 int insertionPointLineNumber();
107 JSStringRef selectedTextRange();
109 bool isRequired() const;
110 bool isSelected() const;
111 bool isExpanded() const;
112 int hierarchicalLevel() const;
113 double clickPointX();
114 double clickPointY();
115 JSStringRef documentEncoding();
116 JSStringRef documentURI();
118 // Table-specific attributes
119 JSStringRef attributesOfColumnHeaders();
120 JSStringRef attributesOfRowHeaders();
121 JSStringRef attributesOfColumns();
122 JSStringRef attributesOfRows();
123 JSStringRef attributesOfVisibleCells();
124 JSStringRef attributesOfHeader();
126 JSStringRef rowIndexRange();
127 JSStringRef columnIndexRange();
129 // Tree/Outline specific attributes
130 AccessibilityUIElement selectedRowAtIndex(unsigned);
131 AccessibilityUIElement disclosedByRow();
132 AccessibilityUIElement disclosedRowAtIndex(unsigned);
134 // Parameterized attributes
135 int lineForIndex(int);
136 JSStringRef boundsForRange(unsigned location, unsigned length);
137 void setSelectedTextRange(unsigned location, unsigned length);
138 JSStringRef stringForRange(unsigned location, unsigned length);
141 AccessibilityUIElement cellForColumnAndRow(unsigned column, unsigned row);
144 static JSClassRef getJSClass();
146 PlatformUIElement m_element;
149 #endif // AccessibilityUIElement_h