summaryrefslogtreecommitdiffstats
path: root/accessible/interfaces/nsIAccessiblePivot.idl
blob: f48dc149c6722f51344bcc0d8ec525621d25cc0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

typedef short PivotMoveReason;

interface nsIAccessible;
interface nsIAccessibleTraversalRule;

/**
 * The pivot interface encapsulates a reference to a single place in an accessible
 * subtree. The pivot is a point or a range in the accessible tree. This interface
 * provides traversal methods to move the pivot to next/prev state that complies
 * to a given rule.
 */
[scriptable, uuid(81fe5144-059b-42db-bd3a-f6ce3158d5e9)]
interface nsIAccessiblePivot : nsISupports
{
  /**
   * Move pivot to next object, from current position or given anchor,
   * complying to given traversal rule.
   *
   * @param aRule            [in] traversal rule to use.
   * @param aAnchor          [in] accessible to start search from, if not provided,
   *                           current position will be used.
   * @param aIncludeStart    [in] include anchor accessible in search.
   * @return next accessible node that matches rule in preorder.
   */
  [optional_argc] nsIAccessible next(in nsIAccessible aAnchor,
                                     in nsIAccessibleTraversalRule aRule,
                                     [optional] in boolean aIncludeStart);

  /**
   * Move pivot to previous object, from current position or given anchor,
   * complying to given traversal rule.
   *
   * @param aRule            [in] traversal rule to use.
   * @param aAnchor          [in] accessible to start search from, if not provided,
   *                           current position will be used.
   * @param aIncludeStart    [in] include anchor accessible in search.
   * @return previous accessible node that matches rule in preorder.
   */
  [optional_argc] nsIAccessible prev(in nsIAccessible aAnchor,
                                     in nsIAccessibleTraversalRule aRule,
                                     [optional] in boolean aIncludeStart);

  /**
   * Move pivot to first object in subtree complying to given traversal rule.
   *
   * @param aRule            [in] traversal rule to use.
   * @return first accessible node in subtree that matches rule in preorder.
   */
  nsIAccessible first(in nsIAccessibleTraversalRule aRule);

  /**
   * Move pivot to last object in subtree complying to given traversal rule.
   *
   * @param aRule            [in] traversal rule to use.
   * @return last accessible node in subtree that matches rule in preorder.
   */
  nsIAccessible last(in nsIAccessibleTraversalRule aRule);

  /**
   * Move pivot to given coordinate in screen pixels.
   *
   * @param aX               [in]  screen's x coordinate
   * @param aY               [in]  screen's y coordinate
   * @param aRule            [in]  raversal rule to use.
   * @return highest accessible in subtree that matches rule at given point.
   */
  nsIAccessible atPoint(in long aX, in long aY,
                        in nsIAccessibleTraversalRule aRule);
};

[scriptable, uuid(e197460d-1eff-4247-b4bb-a43be1840dae)]
interface nsIAccessibleTraversalRule : nsISupports
{
  /* Ignore this accessible object */
  const unsigned short FILTER_IGNORE = 0x0;
  /* Accept this accessible object */
  const unsigned short FILTER_MATCH = 0x1;
  /* Don't traverse accessibles children */
  const unsigned short FILTER_IGNORE_SUBTREE = 0x2;

  /**
   * Determines if a given accessible is to be accepted in our traversal rule
   *
   * @param aAccessible [in] accessible to examine.
   * @return a bitfield of FILTER_MATCH and FILTER_IGNORE_SUBTREE.
   */
  unsigned short match(in nsIAccessible aAccessible);
};