1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is mozilla.org code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * John Gaunt (jgaunt@netscape.com)
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either of the GNU General Public License Version 2 or later (the "GPL"),
27 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #ifndef _nsBaseWidgetAccessible_H_
40 : #define _nsBaseWidgetAccessible_H_
41 :
42 : #include "nsAccessibleWrap.h"
43 : #include "nsHyperTextAccessibleWrap.h"
44 : #include "nsIContent.h"
45 :
46 : /**
47 : * This file contains a number of classes that are used as base
48 : * classes for the different accessibility implementations of
49 : * the HTML and XUL widget sets. --jgaunt
50 : */
51 :
52 : /**
53 : * Leaf version of DOM Accessible -- has no children
54 : */
55 : class nsLeafAccessible : public nsAccessibleWrap
56 0 : {
57 : public:
58 :
59 : nsLeafAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
60 :
61 : // nsISupports
62 : NS_DECL_ISUPPORTS_INHERITED
63 :
64 : // nsAccessible
65 : virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
66 : EWhichChildAtPoint aWhichChild);
67 :
68 : protected:
69 :
70 : // nsAccessible
71 : virtual void CacheChildren();
72 : };
73 :
74 : /**
75 : * Used for text or image accessible nodes contained by link accessibles or
76 : * accessibles for nodes with registered click event handler. It knows how to
77 : * report the state of the host link (traveled or not) and can activate (click)
78 : * the host accessible programmatically.
79 : */
80 : class nsLinkableAccessible : public nsAccessibleWrap
81 0 : {
82 : public:
83 : enum { eAction_Jump = 0 };
84 :
85 : nsLinkableAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
86 :
87 : NS_DECL_ISUPPORTS_INHERITED
88 :
89 : // nsIAccessible
90 : NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
91 : NS_IMETHOD DoAction(PRUint8 index);
92 : NS_IMETHOD GetValue(nsAString& _retval);
93 : NS_IMETHOD TakeFocus();
94 :
95 : // nsAccessNode
96 : virtual void Shutdown();
97 :
98 : // nsAccessible
99 : virtual PRUint64 NativeState();
100 :
101 : // ActionAccessible
102 : virtual PRUint8 ActionCount();
103 : virtual KeyBinding AccessKey() const;
104 :
105 : // HyperLinkAccessible
106 : virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);
107 :
108 : protected:
109 : // nsAccessible
110 : virtual void BindToParent(nsAccessible* aParent, PRUint32 aIndexInParent);
111 : virtual void UnbindFromParent();
112 :
113 : /**
114 : * Parent accessible that provides an action for this linkable accessible.
115 : */
116 : nsAccessible* mActionAcc;
117 : bool mIsLink;
118 : bool mIsOnclick;
119 : };
120 :
121 : /**
122 : * A simple accessible that gets its enumerated role passed into constructor.
123 : */
124 : class nsEnumRoleAccessible : public nsAccessibleWrap
125 : {
126 : public:
127 : nsEnumRoleAccessible(nsIContent* aContent, nsDocAccessible* aDoc,
128 : mozilla::a11y::role aRole);
129 0 : virtual ~nsEnumRoleAccessible() { }
130 :
131 : NS_DECL_ISUPPORTS_INHERITED
132 :
133 : // nsAccessible
134 : virtual mozilla::a11y::role NativeRole();
135 :
136 : protected:
137 : mozilla::a11y::role mRole;
138 : };
139 :
140 : #endif
|