Bug 1825212 [wpt PR 39266] - [@scope] Propagate proximity from SubResult, a=testonly
[gecko.git] / dom / xul / XULMenuBarElement.h
blob117682642d2aacacd03911c5154e67f2b280d3c1
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef XULMenuBarElement_h__
8 #define XULMenuBarElement_h__
10 #include "mozilla/Attributes.h"
11 #include "mozilla/dom/NameSpaceConstants.h"
12 #include "nsINode.h"
13 #include "nsISupports.h"
14 #include "XULMenuParentElement.h"
16 namespace mozilla::dom {
18 class KeyboardEvent;
19 class XULButtonElement;
20 class MenuBarListener;
22 nsXULElement* NS_NewXULMenuBarElement(
23 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
25 class XULMenuBarElement final : public XULMenuParentElement {
26 public:
27 NS_DECL_ISUPPORTS_INHERITED
28 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULMenuBarElement,
29 XULMenuParentElement)
30 NS_IMPL_FROMNODE_WITH_TAG(XULMenuBarElement, kNameSpaceID_XUL, menubar)
32 explicit XULMenuBarElement(already_AddRefed<class NodeInfo>&&);
34 MOZ_CAN_RUN_SCRIPT void SetActive(bool);
35 bool IsActive() const { return mIsActive; }
37 void SetActiveByKeyboard() { mActiveByKeyboard = true; }
38 bool IsActiveByKeyboard() const { return mActiveByKeyboard; }
40 nsresult BindToTree(BindContext&, nsINode& aParent) override;
41 void UnbindFromTree(bool aNullParent) override;
43 protected:
44 ~XULMenuBarElement() override;
46 // Whether or not the menu bar is active (a menu item is highlighted or
47 // shown).
48 bool mIsActive = false;
50 // Whether the menubar was made active via the keyboard.
51 bool mActiveByKeyboard = false;
53 // The event listener that listens to document key presses and so on.
54 RefPtr<MenuBarListener> mListener;
57 } // namespace mozilla::dom
59 #endif // XULMenuBarElement_h