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 : * Author: Aaron Leventhal (aaronl@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 _nsXULMenuAccessible_H_
40 : #define _nsXULMenuAccessible_H_
41 :
42 : #include "nsAccessibleWrap.h"
43 : #include "nsIDOMXULSelectCntrlEl.h"
44 : #include "XULSelectControlAccessible.h"
45 :
46 : /**
47 : * Used for XUL menu, menuitem elements.
48 : */
49 : class nsXULMenuitemAccessible : public nsAccessibleWrap
50 0 : {
51 : public:
52 : enum { eAction_Click = 0 };
53 :
54 : nsXULMenuitemAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
55 :
56 : // nsIAccessible
57 : NS_IMETHOD DoAction(PRUint8 index);
58 : NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
59 :
60 : // nsAccessible
61 : virtual void Description(nsString& aDescription);
62 : virtual nsresult GetNameInternal(nsAString& aName);
63 : virtual mozilla::a11y::role NativeRole();
64 : virtual PRUint64 NativeState();
65 : virtual PRInt32 GetLevelInternal();
66 :
67 : virtual bool CanHaveAnonChildren();
68 :
69 : // ActionAccessible
70 : virtual PRUint8 ActionCount();
71 : virtual KeyBinding AccessKey() const;
72 : virtual KeyBinding KeyboardShortcut() const;
73 :
74 : // Widgets
75 : virtual bool IsActiveWidget() const;
76 : virtual bool AreItemsOperable() const;
77 : virtual nsAccessible* ContainerWidget() const;
78 : };
79 :
80 : /**
81 : * Used for XUL menuseparator element.
82 : */
83 : class nsXULMenuSeparatorAccessible : public nsXULMenuitemAccessible
84 0 : {
85 : public:
86 : nsXULMenuSeparatorAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
87 :
88 : // nsIAccessible
89 : NS_IMETHOD DoAction(PRUint8 index);
90 : NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
91 :
92 : // nsAccessible
93 : virtual nsresult GetNameInternal(nsAString& aName);
94 : virtual mozilla::a11y::role NativeRole();
95 : virtual PRUint64 NativeState();
96 :
97 : // ActionAccessible
98 : virtual PRUint8 ActionCount();
99 : };
100 :
101 :
102 : /**
103 : * Used for XUL menupopup and panel.
104 : */
105 : class nsXULMenupopupAccessible : public XULSelectControlAccessible
106 0 : {
107 : public:
108 : nsXULMenupopupAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
109 :
110 : // nsAccessible
111 : virtual nsresult GetNameInternal(nsAString& aName);
112 : virtual mozilla::a11y::role NativeRole();
113 : virtual PRUint64 NativeState();
114 :
115 : // Widgets
116 : virtual bool IsWidget() const;
117 : virtual bool IsActiveWidget() const;
118 : virtual bool AreItemsOperable() const;
119 :
120 : virtual nsAccessible* ContainerWidget() const;
121 : };
122 :
123 : /**
124 : * Used for XUL menubar element.
125 : */
126 : class nsXULMenubarAccessible : public nsAccessibleWrap
127 0 : {
128 : public:
129 : nsXULMenubarAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
130 :
131 : // nsAccessible
132 : virtual nsresult GetNameInternal(nsAString& aName);
133 : virtual mozilla::a11y::role NativeRole();
134 : virtual PRUint64 NativeState();
135 :
136 : // Widget
137 : virtual bool IsActiveWidget() const;
138 : virtual bool AreItemsOperable() const;
139 : virtual nsAccessible* CurrentItem();
140 : virtual void SetCurrentItem(nsAccessible* aItem);
141 : };
142 :
143 : #endif
|