1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_a11y_XULMenuAccessible_h__
7 #define mozilla_a11y_XULMenuAccessible_h__
9 #include "AccessibleWrap.h"
10 #include "nsIDOMXULSelectCntrlEl.h"
11 #include "XULSelectControlAccessible.h"
17 * Used for XUL menu, menuitem elements.
19 class XULMenuitemAccessible
: public AccessibleWrap
22 enum { eAction_Click
= 0 };
24 XULMenuitemAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
27 virtual void Description(nsString
& aDescription
) override
;
28 virtual a11y::role
NativeRole() const override
;
29 virtual uint64_t NativeState() const override
;
30 virtual uint64_t NativeInteractiveState() const override
;
31 virtual int32_t GetLevelInternal() override
;
34 virtual uint8_t ActionCount() const override
;
35 virtual void ActionNameAt(uint8_t aIndex
, nsAString
& aName
) override
;
36 virtual bool DoAction(uint8_t aIndex
) const override
;
37 virtual KeyBinding
AccessKey() const override
;
38 virtual KeyBinding
KeyboardShortcut() const override
;
41 virtual bool IsActiveWidget() const override
;
42 virtual bool AreItemsOperable() const override
;
43 virtual Accessible
* ContainerWidget() const override
;
47 virtual ENameValueFlag
NativeName(nsString
& aName
) const override
;
51 * Used for XUL menuseparator element.
53 class XULMenuSeparatorAccessible
: public XULMenuitemAccessible
56 XULMenuSeparatorAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
59 virtual a11y::role
NativeRole() const override
;
60 virtual uint64_t NativeState() const override
;
63 virtual uint8_t ActionCount() const override
;
64 virtual void ActionNameAt(uint8_t aIndex
, nsAString
& aName
) override
;
65 virtual bool DoAction(uint8_t aIndex
) const override
;
69 virtual ENameValueFlag
NativeName(nsString
& aName
) const override
;
74 * Used for XUL menupopup and panel.
76 class XULMenupopupAccessible
: public XULSelectControlAccessible
79 XULMenupopupAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
82 virtual a11y::role
NativeRole() const override
;
83 virtual uint64_t NativeState() const override
;
86 virtual bool IsWidget() const override
;
87 virtual bool IsActiveWidget() const override
;
88 virtual bool AreItemsOperable() const override
;
90 virtual Accessible
* ContainerWidget() const override
;
94 virtual ENameValueFlag
NativeName(nsString
& aName
) const override
;
98 * Used for XUL menubar element.
100 class XULMenubarAccessible
: public AccessibleWrap
103 XULMenubarAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
106 virtual a11y::role
NativeRole() const override
;
109 virtual bool IsActiveWidget() const override
;
110 virtual bool AreItemsOperable() const override
;
111 virtual Accessible
* CurrentItem() const override
;
112 virtual void SetCurrentItem(const Accessible
* aItem
) override
;
116 virtual ENameValueFlag
NativeName(nsString
& aName
) const override
;
120 } // namespace mozilla