Bug 460926 A11y hierachy is broken on Ubuntu 8.10 (GNOME 2.24), r=Evan.Yan sr=roc
[wine-gecko.git] / accessible / src / base / nsBaseWidgetAccessible.h
blob818e43b9a657a1a9fbd72afdfda6926bd05dabec
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
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/
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.
15 * The Original Code is mozilla.org code.
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.
22 * Contributor(s):
23 * John Gaunt (jgaunt@netscape.com)
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.
37 * ***** END LICENSE BLOCK ***** */
39 #ifndef _nsBaseWidgetAccessible_H_
40 #define _nsBaseWidgetAccessible_H_
42 #include "nsAccessibleWrap.h"
43 #include "nsHyperTextAccessibleWrap.h"
44 #include "nsIContent.h"
46 class nsIDOMNode;
48 /**
49 * This file contains a number of classes that are used as base
50 * classes for the different accessibility implementations of
51 * the HTML and XUL widget sets. --jgaunt
54 /**
55 * Leaf version of DOM Accessible -- has no children
57 class nsLeafAccessible : public nsAccessibleWrap
59 public:
60 nsLeafAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
61 NS_DECL_ISUPPORTS_INHERITED
62 NS_IMETHOD GetFirstChild(nsIAccessible **_retval);
63 NS_IMETHOD GetLastChild(nsIAccessible **_retval);
64 NS_IMETHOD GetChildCount(PRInt32 *_retval);
65 NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
66 NS_IMETHOD GetChildAtPoint(PRInt32 aX, PRInt32 aY, nsIAccessible **aAccessible)
67 { NS_ENSURE_ARG_POINTER(aAccessible); NS_ADDREF(*aAccessible = this); return NS_OK; } // Don't walk into these
70 /**
71 * A type of accessible for DOM nodes containing an href="" attribute.
72 * It knows how to report the state of the link ( traveled or not )
73 * and can activate ( click ) the link programmatically.
75 class nsLinkableAccessible : public nsHyperTextAccessibleWrap
77 public:
78 enum { eAction_Jump = 0 };
80 nsLinkableAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
82 NS_DECL_ISUPPORTS_INHERITED
84 // nsIAccessible
85 NS_IMETHOD GetNumActions(PRUint8 *_retval);
86 NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
87 NS_IMETHOD DoAction(PRUint8 index);
88 NS_IMETHOD GetValue(nsAString& _retval);
89 NS_IMETHOD TakeFocus();
90 NS_IMETHOD GetKeyboardShortcut(nsAString& _retval);
92 // nsIHyperLinkAccessible
93 NS_IMETHOD GetURI(PRInt32 i, nsIURI **aURI);
95 // nsAccessNode
96 virtual nsresult Init();
97 virtual nsresult Shutdown();
99 // nsAccessible
100 virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
102 protected:
104 * Return an accessible for cached action node.
106 already_AddRefed<nsIAccessible> GetActionAccessible();
109 * Cache action node.
111 virtual void CacheActionContent();
113 nsCOMPtr<nsIContent> mActionContent;
114 PRPackedBool mIsLink;
115 PRPackedBool mIsOnclick;
119 * A simple accessible that gets its enumerated role passed into constructor.
121 class nsEnumRoleAccessible : public nsAccessibleWrap
123 public:
124 nsEnumRoleAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell, PRUint32 aRole);
125 virtual ~nsEnumRoleAccessible() { }
126 NS_DECL_ISUPPORTS_INHERITED
127 NS_IMETHODIMP GetRole(PRUint32 *aRole) { *aRole = mRole; return NS_OK; }
129 protected:
130 PRUint32 mRole;
133 #endif