|
1 /* |
|
2 * Copyright (C) 2009 Google Inc. All rights reserved. |
|
3 * |
|
4 * Redistribution and use in source and binary forms, with or without |
|
5 * modification, are permitted provided that the following conditions are |
|
6 * met: |
|
7 * |
|
8 * * Redistributions of source code must retain the above copyright |
|
9 * notice, this list of conditions and the following disclaimer. |
|
10 * * Redistributions in binary form must reproduce the above |
|
11 * copyright notice, this list of conditions and the following disclaimer |
|
12 * in the documentation and/or other materials provided with the |
|
13 * distribution. |
|
14 * * Neither the name of Google Inc. nor the names of its |
|
15 * contributors may be used to endorse or promote products derived from |
|
16 * this software without specific prior written permission. |
|
17 * |
|
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
29 */ |
|
30 |
|
31 #ifndef WebAccessibilityObject_h |
|
32 #define WebAccessibilityObject_h |
|
33 |
|
34 #include "WebAccessibilityRole.h" |
|
35 #include "WebCommon.h" |
|
36 |
|
37 #if WEBKIT_IMPLEMENTATION |
|
38 namespace WebCore { class AccessibilityObject; } |
|
39 namespace WTF { template <typename T> class PassRefPtr; } |
|
40 #endif |
|
41 |
|
42 namespace WebKit { |
|
43 |
|
44 class WebAccessibilityObjectPrivate; |
|
45 class WebString; |
|
46 struct WebPoint; |
|
47 struct WebRect; |
|
48 |
|
49 // A container for passing around a reference to AccessibilityObject. |
|
50 class WebAccessibilityObject { |
|
51 public: |
|
52 ~WebAccessibilityObject() { reset(); } |
|
53 |
|
54 WebAccessibilityObject() : m_private(0) { } |
|
55 WebAccessibilityObject(const WebAccessibilityObject& o) : m_private(0) { assign(o); } |
|
56 WebAccessibilityObject& operator=(const WebAccessibilityObject& o) |
|
57 { |
|
58 assign(o); |
|
59 return *this; |
|
60 } |
|
61 |
|
62 WEBKIT_API void reset(); |
|
63 WEBKIT_API void assign(const WebAccessibilityObject&); |
|
64 |
|
65 bool isNull() const { return !m_private; } |
|
66 |
|
67 WEBKIT_API WebString accessibilityDescription() const; |
|
68 WEBKIT_API WebString actionVerb() const; |
|
69 WEBKIT_API bool canSetFocusAttribute() const; |
|
70 WEBKIT_API bool canSetValueAttribute() const; |
|
71 |
|
72 WEBKIT_API unsigned childCount() const; |
|
73 |
|
74 WEBKIT_API WebAccessibilityObject childAt(unsigned) const; |
|
75 WEBKIT_API WebAccessibilityObject firstChild() const; |
|
76 WEBKIT_API WebAccessibilityObject focusedChild() const; |
|
77 WEBKIT_API WebAccessibilityObject lastChild() const; |
|
78 WEBKIT_API WebAccessibilityObject nextSibling() const; |
|
79 WEBKIT_API WebAccessibilityObject parentObject() const; |
|
80 WEBKIT_API WebAccessibilityObject previousSibling() const; |
|
81 |
|
82 WEBKIT_API bool isAnchor() const; |
|
83 WEBKIT_API bool isChecked() const; |
|
84 WEBKIT_API bool isFocused() const; |
|
85 WEBKIT_API bool isEnabled() const; |
|
86 WEBKIT_API bool isHovered() const; |
|
87 WEBKIT_API bool isIndeterminate() const; |
|
88 WEBKIT_API bool isMultiSelectable() const; |
|
89 WEBKIT_API bool isOffScreen() const; |
|
90 WEBKIT_API bool isPasswordField() const; |
|
91 WEBKIT_API bool isPressed() const; |
|
92 WEBKIT_API bool isReadOnly() const; |
|
93 WEBKIT_API bool isVisited() const; |
|
94 |
|
95 WEBKIT_API WebRect boundingBoxRect() const; |
|
96 WEBKIT_API WebString helpText() const; |
|
97 WEBKIT_API int headingLevel() const; |
|
98 WEBKIT_API WebAccessibilityObject hitTest(const WebPoint&) const; |
|
99 WEBKIT_API WebString keyboardShortcut() const; |
|
100 WEBKIT_API bool performDefaultAction() const; |
|
101 WEBKIT_API WebAccessibilityRole roleValue() const; |
|
102 WEBKIT_API void setFocused(bool) const; |
|
103 WEBKIT_API WebString stringValue() const; |
|
104 WEBKIT_API WebString title() const; |
|
105 |
|
106 #if WEBKIT_IMPLEMENTATION |
|
107 WebAccessibilityObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>&); |
|
108 WebAccessibilityObject& operator=(const WTF::PassRefPtr<WebCore::AccessibilityObject>&); |
|
109 operator WTF::PassRefPtr<WebCore::AccessibilityObject>() const; |
|
110 #endif |
|
111 |
|
112 private: |
|
113 void assign(WebAccessibilityObjectPrivate*); |
|
114 WebAccessibilityObjectPrivate* m_private; |
|
115 }; |
|
116 |
|
117 } // namespace WebKit |
|
118 |
|
119 #endif |