tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

XULMenuBarElement.h (1864B)


      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/. */
      6 
      7 #ifndef XULMenuBarElement_h__
      8 #define XULMenuBarElement_h__
      9 
     10 #include "XULMenuParentElement.h"
     11 #include "mozilla/Attributes.h"
     12 #include "mozilla/dom/NameSpaceConstants.h"
     13 #include "nsINode.h"
     14 #include "nsISupports.h"
     15 
     16 namespace mozilla::dom {
     17 
     18 class KeyboardEvent;
     19 class XULButtonElement;
     20 class MenuBarListener;
     21 
     22 nsXULElement* NS_NewXULMenuBarElement(
     23    already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
     24 
     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)
     31 
     32  explicit XULMenuBarElement(already_AddRefed<class NodeInfo>&&);
     33 
     34  MOZ_CAN_RUN_SCRIPT void SetActive(bool);
     35  bool IsActive() const { return mIsActive; }
     36 
     37  void SetActiveByKeyboard() { mActiveByKeyboard = true; }
     38  bool IsActiveByKeyboard() const { return mActiveByKeyboard; }
     39 
     40  nsresult BindToTree(BindContext&, nsINode& aParent) override;
     41  void UnbindFromTree(UnbindContext&) override;
     42 
     43 protected:
     44  ~XULMenuBarElement() override;
     45 
     46  // Whether or not the menu bar is active (a menu item is highlighted or
     47  // shown).
     48  bool mIsActive = false;
     49 
     50  // Whether the menubar was made active via the keyboard.
     51  bool mActiveByKeyboard = false;
     52 
     53  // The event listener that listens to document key presses and so on.
     54  RefPtr<MenuBarListener> mListener;
     55 };
     56 
     57 }  // namespace mozilla::dom
     58 
     59 #endif  // XULMenuBarElement_h