Bug 1878930 - s/RawBuffer/Span/: UniformData. r=gfx-reviewers,lsalzman
[gecko.git] / dom / xul / nsXULPopupListener.h
blobac5a631118a7ffec266506ee35f0afc2f280e5f8
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 /**
7 * This is the popup listener implementation for popup menus and context menus.
8 */
10 #ifndef nsXULPopupListener_h___
11 #define nsXULPopupListener_h___
13 #include "nsCOMPtr.h"
15 #include "nsIDOMEventListener.h"
16 #include "nsCycleCollectionParticipant.h"
18 class nsIContent;
20 namespace mozilla::dom {
21 class Element;
22 class MouseEvent;
23 } // namespace mozilla::dom
25 class nsXULPopupListener : public nsIDOMEventListener {
26 public:
27 // aElement is the element that the popup is attached to. If aIsContext is
28 // false, the popup opens on left click on aElement or a descendant. If
29 // aIsContext is true, the popup is a context menu which opens on a
30 // context menu event.
31 nsXULPopupListener(mozilla::dom::Element* aElement, bool aIsContext);
33 // nsISupports
34 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
35 NS_DECL_CYCLE_COLLECTION_SKIPPABLE_CLASS(nsXULPopupListener)
36 NS_DECL_NSIDOMEVENTLISTENER
38 protected:
39 virtual ~nsXULPopupListener(void);
41 // open the popup. aEvent is the event that triggered the popup such as
42 // a mouse click and aTargetContent is the target of this event.
43 virtual nsresult LaunchPopup(mozilla::dom::MouseEvent* aEvent);
45 // close the popup when the listener goes away
46 virtual void ClosePopup();
48 private:
49 // |mElement| is the node to which this listener is attached.
50 RefPtr<mozilla::dom::Element> mElement;
52 // The popup that is getting shown on top of mElement.
53 RefPtr<mozilla::dom::Element> mPopupContent;
55 // true if a context popup
56 bool mIsContext;
59 #endif // nsXULPopupListener_h___