Bug 1793579 [wpt PR 36253] - Set empty string for reflection of IDREF attributes...
[gecko.git] / widget / nsIRollupListener.h
blob1b5b1d6efcf55930559f982e2b696880550b5c91
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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 __nsIRollupListener_h__
8 #define __nsIRollupListener_h__
10 #include "nsTArray.h"
11 #include "nsPoint.h"
12 #include "Units.h"
14 class nsIContent;
15 class nsIWidget;
17 class nsIRollupListener {
18 public:
19 /**
20 * Notifies the object to rollup, optionally returning the node that
21 * was just rolled up.
23 * If aFlush is true, then views should be flushed after the rollup.
25 * aPoint is the mouse pointer position where the event that triggered the
26 * rollup occurred, which may be nullptr.
28 * aCount is the number of popups in a chain to close. If this is
29 * UINT32_MAX, then all popups are closed.
30 * If aLastRolledUp is non-null, it will be set to the last rolled up popup,
31 * if this is supported. aLastRolledUp is not addrefed.
33 * Returns true if the event that the caller is processing should be consumed.
35 MOZ_CAN_RUN_SCRIPT_BOUNDARY
36 virtual bool Rollup(uint32_t aCount, bool aFlush,
37 const mozilla::LayoutDeviceIntPoint* aPoint,
38 nsIContent** aLastRolledUp) = 0;
40 /**
41 * Asks the RollupListener if it should rollup on mouse wheel events
43 virtual bool ShouldRollupOnMouseWheelEvent() = 0;
45 /**
46 * Asks the RollupListener if it should consume mouse wheel events
48 virtual bool ShouldConsumeOnMouseWheelEvent() = 0;
50 /**
51 * Asks the RollupListener if it should rollup on mouse activate, eg. X-Mouse
53 virtual bool ShouldRollupOnMouseActivate() = 0;
56 * Retrieve the widgets for open menus and store them in the array
57 * aWidgetChain. The number of menus of the same type should be returned,
58 * for example, if a context menu is open, return only the number of menus
59 * that are part of the context menu chain. This allows closing up only
60 * those menus in different situations. The returned value should be exactly
61 * the same number of widgets added to aWidgetChain.
63 virtual uint32_t GetSubmenuWidgetChain(
64 nsTArray<nsIWidget*>* aWidgetChain) = 0;
66 virtual nsIWidget* GetRollupWidget() = 0;
68 /**
69 * If a native menu is currently shown, closes the menu.
70 * Returns true if a native menu was open.
72 virtual bool RollupNativeMenu() { return false; }
75 #endif /* __nsIRollupListener_h__ */