diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/xul/nsXULPopupListener.h | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/xul/nsXULPopupListener.h')
-rw-r--r-- | dom/xul/nsXULPopupListener.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/dom/xul/nsXULPopupListener.h b/dom/xul/nsXULPopupListener.h new file mode 100644 index 0000000000..ac5a631118 --- /dev/null +++ b/dom/xul/nsXULPopupListener.h @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * This is the popup listener implementation for popup menus and context menus. + */ + +#ifndef nsXULPopupListener_h___ +#define nsXULPopupListener_h___ + +#include "nsCOMPtr.h" + +#include "nsIDOMEventListener.h" +#include "nsCycleCollectionParticipant.h" + +class nsIContent; + +namespace mozilla::dom { +class Element; +class MouseEvent; +} // namespace mozilla::dom + +class nsXULPopupListener : public nsIDOMEventListener { + public: + // aElement is the element that the popup is attached to. If aIsContext is + // false, the popup opens on left click on aElement or a descendant. If + // aIsContext is true, the popup is a context menu which opens on a + // context menu event. + nsXULPopupListener(mozilla::dom::Element* aElement, bool aIsContext); + + // nsISupports + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SKIPPABLE_CLASS(nsXULPopupListener) + NS_DECL_NSIDOMEVENTLISTENER + + protected: + virtual ~nsXULPopupListener(void); + + // open the popup. aEvent is the event that triggered the popup such as + // a mouse click and aTargetContent is the target of this event. + virtual nsresult LaunchPopup(mozilla::dom::MouseEvent* aEvent); + + // close the popup when the listener goes away + virtual void ClosePopup(); + + private: + // |mElement| is the node to which this listener is attached. + RefPtr<mozilla::dom::Element> mElement; + + // The popup that is getting shown on top of mElement. + RefPtr<mozilla::dom::Element> mPopupContent; + + // true if a context popup + bool mIsContext; +}; + +#endif // nsXULPopupListener_h___ |