Bug 1473362 [wpt PR 11778] - Update wpt metadata, a=testonly
[gecko.git] / accessible / xul / XULMenuAccessible.h
blob47dc22b6f9eb916e14d5792ff47c7808549345c0
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"
13 namespace mozilla {
14 namespace a11y {
16 /**
17 * Used for XUL menu, menuitem elements.
19 class XULMenuitemAccessible : public AccessibleWrap
21 public:
22 enum { eAction_Click = 0 };
24 XULMenuitemAccessible(nsIContent* aContent, DocAccessible* aDoc);
26 // Accessible
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;
33 // ActionAccessible
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;
40 // Widgets
41 virtual bool IsActiveWidget() const override;
42 virtual bool AreItemsOperable() const override;
43 virtual Accessible* ContainerWidget() const override;
45 protected:
46 // Accessible
47 virtual ENameValueFlag NativeName(nsString& aName) const override;
50 /**
51 * Used for XUL menuseparator element.
53 class XULMenuSeparatorAccessible : public XULMenuitemAccessible
55 public:
56 XULMenuSeparatorAccessible(nsIContent* aContent, DocAccessible* aDoc);
58 // Accessible
59 virtual a11y::role NativeRole() const override;
60 virtual uint64_t NativeState() const override;
62 // ActionAccessible
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;
67 protected:
68 // Accessible
69 virtual ENameValueFlag NativeName(nsString& aName) const override;
73 /**
74 * Used for XUL menupopup and panel.
76 class XULMenupopupAccessible : public XULSelectControlAccessible
78 public:
79 XULMenupopupAccessible(nsIContent* aContent, DocAccessible* aDoc);
81 // Accessible
82 virtual a11y::role NativeRole() const override;
83 virtual uint64_t NativeState() const override;
85 // Widgets
86 virtual bool IsWidget() const override;
87 virtual bool IsActiveWidget() const override;
88 virtual bool AreItemsOperable() const override;
90 virtual Accessible* ContainerWidget() const override;
92 protected:
93 // Accessible
94 virtual ENameValueFlag NativeName(nsString& aName) const override;
97 /**
98 * Used for XUL menubar element.
100 class XULMenubarAccessible : public AccessibleWrap
102 public:
103 XULMenubarAccessible(nsIContent* aContent, DocAccessible* aDoc);
105 // Accessible
106 virtual a11y::role NativeRole() const override;
108 // Widget
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;
114 protected:
115 // Accessible
116 virtual ENameValueFlag NativeName(nsString& aName) const override;
119 } // namespace a11y
120 } // namespace mozilla
122 #endif