OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_DELEGATE_H_ | 5 #ifndef UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_DELEGATE_H_ |
6 #define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_DELEGATE_H_ | 6 #define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_DELEGATE_H_ |
7 | 7 |
8 #include "ui/accessibility/ax_enums.h" | 8 #include "ui/accessibility/ax_enums.h" |
9 #include "ui/accessibility/ax_export.h" | 9 #include "ui/accessibility/ax_export.h" |
10 #include "ui/gfx/geometry/vector2d.h" | 10 #include "ui/gfx/geometry/vector2d.h" |
11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
12 | 12 |
13 namespace ui { | 13 namespace ui { |
14 | 14 |
15 struct AXNodeData; | 15 struct AXNodeData; |
16 class AXPlatformNode; | 16 class AXPlatformNode; |
17 | 17 |
18 // An object that wants to be accessible should derive from this class. | |
19 // AXPlatformNode subclasses use this interface to query all of the information | |
20 // about the object in order to implement native accessibility APIs. | |
21 // | |
22 // Note that AXPlatformNode has support for accessibility trees where some | |
23 // of the objects in the tree are not implemented using AXPlatformNode. | |
24 // For example, you may have a native window with platform-native widgets | |
25 // in it, but in that window you have custom controls that use AXPlatformNode | |
26 // to provide accessibility. So when you're implementing | |
David Tseng
2015/02/13 20:10:11
?
dmazzoni
2015/02/17 22:48:05
Done.
| |
18 class AX_EXPORT AXPlatformNodeDelegate { | 27 class AX_EXPORT AXPlatformNodeDelegate { |
19 public: | 28 public: |
20 // Get the accessibility data that should be exposed for this node. | 29 // Get the accessibility data that should be exposed for this node. |
21 virtual AXNodeData* GetData() = 0; | 30 // Virtually all of the information is obtained from this structure |
31 // (role, state, name, cursor position, etc.) - the rest of this interface | |
32 // is mostly to implement support for walking the accessibility tree. | |
33 virtual const AXNodeData* GetData() = 0; | |
22 | 34 |
23 // Get the parent of the node unless it's the root, then it returns NULL. | 35 // Get the parent of the node, which may be an AXPlatformNode or it may |
36 // be a native accessible object implemented by another class. | |
24 virtual gfx::NativeViewAccessible GetParent() = 0; | 37 virtual gfx::NativeViewAccessible GetParent() = 0; |
25 | 38 |
26 // Get the number of children of this node. | 39 // Get the number of children of this node. |
27 virtual int GetChildCount() = 0; | 40 virtual int GetChildCount() = 0; |
28 | 41 |
29 // Get the child of a node from [0...GetChildCount() - 1] | 42 // Get the child of a node given a 0-based index. |
30 virtual gfx::NativeViewAccessible ChildAtIndex(int index) = 0; | 43 virtual gfx::NativeViewAccessible ChildAtIndex(int index) = 0; |
31 | 44 |
45 // Get the 0-based index of this node in its parent. | |
46 virtual int GetIndexInParent() = 0; | |
47 | |
32 // Get the offset to convert local coordinates to screen global coordinates. | 48 // Get the offset to convert local coordinates to screen global coordinates. |
33 virtual gfx::Vector2d GetGlobalCoordinateOffset() = 0; | 49 virtual gfx::Vector2d GetGlobalCoordinateOffset() = 0; |
34 | 50 |
51 // Do a *synchronous* hit test of the given location in global screen | |
52 // coordinates, and the node within this node's subtree (inclusive) that's | |
53 // hit, if any. | |
54 // | |
55 // This function is mainly used by accessibility debugging software. | |
56 // Platforms with touch accessibility use a different asynchronous interface. | |
57 virtual gfx::NativeViewAccessible HitTest(int x, int y) = 0; | |
David Tseng
2015/02/13 20:10:11
Maybe HitTestSync?
dmazzoni
2015/02/17 22:48:05
Done.
| |
58 | |
59 // Return the node within this node's subtree (inclusive) that currently | |
60 // has focus. | |
61 virtual gfx::NativeViewAccessible GetFocus() = 0; | |
62 | |
35 // | 63 // |
36 // Events. | 64 // Events. |
37 // | 65 // |
38 virtual void NotifyAccessibilityEvent(ui::AXEvent event_type) = 0; | |
39 | 66 |
67 // Return the platform-native GUI object that should be used as a target | |
68 // for accessibility events. | |
69 virtual gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() = 0; | |
70 | |
71 // | |
72 // Actions. | |
73 // | |
74 | |
75 // Perform the default action, e.g. click a button, follow a link, or | |
76 // toggle a checkbox. | |
77 virtual void DoDefaultAction() = 0; | |
78 | |
79 // Change the value of a control, such as the text content of a text field. | |
80 virtual bool SetStringValue(const base::string16& new_value) = 0; | |
40 }; | 81 }; |
41 | 82 |
42 } // namespace ui | 83 } // namespace ui |
43 | 84 |
44 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_DELEGATE_H_ | 85 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_DELEGATE_H_ |
OLD | NEW |