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/. */
7 * This is the popup listener implementation for popup menus and context menus.
10 #ifndef nsXULPopupListener_h___
11 #define nsXULPopupListener_h___
15 #include "nsIDOMEventListener.h"
16 #include "nsCycleCollectionParticipant.h"
20 namespace mozilla::dom
{
23 } // namespace mozilla::dom
25 class nsXULPopupListener
: public nsIDOMEventListener
{
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
);
34 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
35 NS_DECL_CYCLE_COLLECTION_SKIPPABLE_CLASS(nsXULPopupListener
)
36 NS_DECL_NSIDOMEVENTLISTENER
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();
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
59 #endif // nsXULPopupListener_h___